Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

sharepoint 2010 make modified by link just text

Posted on 2012-12-26
2
Medium Priority
?
393 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 2000 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

We had a requirement to extract data from a SharePoint 2010 Customer List into a CSV file and then place the CSV file into a directory on the network so that the file could be consumed by an AS400 system. I will share in Part 1 how to Extract the Da…
When using a search centre, I'm going to show you how to configure Sharepoint's search to only return results from the current site collection. Very useful when using Office 365 with multiple site collections.
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
Screencast - Getting to Know the Pipeline

596 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