Solved

sharepoint 2010 make modified by link just text

Posted on 2012-12-26
2
343 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
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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

There is one common problem that all we SharePoint developers share: custom solution deployment. This topic can't be covered fully in this short article, so all I want to do in this one is to review it from a development-to-operations perspectiv…
Microsoft SharePoint Foundation 2010 and Microsoft SharePoint Server 2010 do not offer the option to configure the location of the SharePoint diagnostic trace log files during installation.  This can, however, be configured through Central Administr…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

757 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now