Solved

sharepoint 2010 make modified by link just text

Posted on 2012-12-26
2
384 Views
Last Modified: 2013-01-08
I am working on a project that has a XsltListViewWebPart on a page that was added programmtically.  This has strange security so I can't put the page in edit mode in the web interface and can't open it in designer.  I need the "modified by" link to display as text and not as a link.  I can edit the web part with the code below, but I am not sure how to access the xslt.  There is a property for a xlsturl, which apparen't can be set as a link to an xslt file.  If I could get a sample and place one someplace, that might work.  If not, I'd love another solution.  



            using (SPSite spSite = new SPSite("http://mysite"))
            {
                using (SPWeb spWeb  = spSite.RootWeb)
                {
                    spWeb.AllowUnsafeUpdates = true;
                    SPFile wikiFile = spWeb.GetFile("Pages/documents.aspx");
                    using (SPLimitedWebPartManager wpm = wikiFile.GetLimitedWebPartManager(System.Web.UI.WebControls.WebParts.PersonalizationScope.Shared))
                    {
                        try
                        {
                            foreach (System.Web.UI.WebControls.WebParts.WebPart wp in wpm.WebParts)
                            {
                                var wp2 = (Microsoft.SharePoint.WebPartPages.XsltListViewWebPart) wp;
                                /*
                                if (wp.Title == "Shared Documents")
                                {
                                    wp.Title = "Project Documents";
                                    wpm.SaveChanges(wp);
                                }
                                */
                            }
                        }
                        catch
                        {
                            if (wpm.Web != null)
                            {
                                wpm.Web.Dispose();
                            }
                        }
                    }
                    spWeb.AllowUnsafeUpdates = false;
                }
            }
           
        }
0
Comment
Question by:jackjohnson44
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 44

Accepted Solution

by:
Rainer Jeschor earned 500 total points
ID: 38743506
Hi,
you should be able to set the Xsl via the property:
wp2.Xsl = "yourxslthere";
if you have propper permissions.
Perhaps you might try to set the property:
AllowXSLTEditing to true
and use SharePoint Designer to modify the Xslt.

http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.webpartpages.xsltlistviewwebpart_members%28v=office.14%29.aspx

HTH
Rainer
0
 

Author Comment

by:jackjohnson44
ID: 38755085
Thanks.  There is a place to link to a new xslt document, but that just didn't work.  I finally just used jQuery.

<script type="text/javascript">
    $(document).ready(function () {
        $('a[href*="userdisp.aspx"]').replaceWith(function() {
            return $(this).text();
        });
    });
</script>
0

Featured Post

Office 365 Training for IT Pros

Learn how to provision tenants, synchronize on-premise Active Directory, implement Single Sign-On, customize Office deployment, and protect your organization with eDiscovery and DLP policies.  Only from Platform Scholar.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Note:  There are two main ways to deploy InfoPath forms:  Server-side and directly through the SharePoint site.  Deploying a server-side InfoPath form means the form is approved by the Administrator, thus allowing greater functionality in the form. …
These days socially coordinated efforts have turned into a critical requirement for enterprises.
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question