Web Part: Sites that I have access to

In many companies, there are a couple of different types of environments.  There is the “intranet” and/or the public site, and both of these types of portals contain sites with mostly one way information.  With these sites, pretty much everyone has access to everything in there.  On the other hand, there’s the “collaboration portal”.  In many cases, this is a separate web application or site collection, where users keep their collab type sites.  These sites are used heavily, and contain dynamic information.  These are usually departmental sites or sites based around a particular project.  When I say departmental sites, I mean that they are sites that only people in that department can get to, so basically there is more security involved with the collab sites, because you want people to only access their own department site, or the site related to only projects that they are involved in.

With that said about collaboration, how do people navigate through all of these sites?  Yes, many of you may have an awesome nav / taxonomy that may be very simple and obvious for the end users.  A lot of times, though, this is what I see: Each time a new collab site is created, the site members each will receive the email that is generated when they have been given permission to the site.  Or, the project manager may create the project site and send the team members the URL to the site.  In these cases, users typically rely on going back to that email in order to click the link when they need to go to that site.  Not optimal.  They also may add the site to their browser’s favorites.  Also not optimal, because there is no one cohesive way for people to know that they can access the sites that they use.

If anything so far sounds familiar, then this may be the solution for you.  This solution is a way to create a single web part that displays a simple list of all of the sites that the current user has access to.  In this example, I’ll be using SharePoint 2010, but this can also be done in 2007.  This is an enterprise only solution, because it involves using the search results web part.

At the high level, this method is nothing new, I’ll be using the search results web part.  Many other SharePoint bloggers have written or done presentations about this concept, such as Matt Bremer, Eric Shupps, Paul Galvin, John Ross, Dan Attis, Tobias Zimmergren, and many more.  I referenced many of their blogs in order to put together this one.

Here are the steps:

  1. On a blank web part page in the browser, insert the Search Core Results web part.
  2. In the web part properties, expand the Display Properties section.  Change the default results sorting to “modified date”. Change the results per page to 50 (this is up to you really, but 50 is the max).  Uncheck the box called “use location visualization”.
    ch5[36]
  3. Also in the web part properties, expand the Results Query Options section.  Change the cross-web part query ID to “Query 2”.
    In the Fixed Keyword Query box, paste the following text:
    contentclass:STS_Site contentclass:STS_Web contentClass:sts_listitem_850
    ch5[37]Basically what we’re doing here is to say that all we want to see in this web part is sites (STS_Site), sub-sites (STS_Web) and publishing sites (sts_listitem_850).
  4. Go ahead and click OK.  You’ll now see a nice, pretty list of all sites.  Since security trimming is built in, you’ll only see the sites that you have access to.  Now technically you could stop here, but you may want to tweak the way this web part looks…
  5. In this same web part’s properties, expand the Display Properties section, and click the <XSL Editor> button. Note that this will be grayed out if you haven’t unchecked the “Use Location Visualization” box.
  6. In the XSL Editor, paste the following code:

    <xsl:stylesheet version=”1.0″
    xmlns:xsl=”
    http://www.w3.org/1999/XSL/Transform&#8221;>
    <xsl:output method=”xml” version=”1.0″ encoding=”UTF-8″ indent=”yes”/>
    <xsl:template match=”/”>
    <xmp><xsl:copy-of select=”*”/></xmp>
    </xsl:template>
    </xsl:stylesheet>

  7. Click SAVE and click OK in the web part tool pane.
  8. Now there will be a bunch of weird looking xml code on the page.  Copy all of this to your clipboard, all the way from the first <All_Results> to the end </All_Results>
  9. Open Notepad.exe and paste your clipboard into it.  <Save As> and save this file name as something like SearchResultsFile.xml, and be sure to change the Save As Type to ALL FILES.  It does need to be an XML file.
  10. Open SharePoint Designer 2010, and open your site.
  11. Click Data Sources on the left side in SharePoint Designer.  Click the XML File Connection button in the ribbon.
    ch5[38]
  12. Click Browse to navigate to the XML file that you just created.  When you select it, you will get a message something like this:
    ch5[40]
    Click OK.
  13. Then your screen will look like this.  Click OK.
    ch5[41]
  14. Open up a web part page in SharePoint Designer.  This doesn’t have to be the same temporary web part page that we used in the previous steps, but it can be… it doesn’t really matter because this one is temporary too.
  15. On the web part page, click inside a web part zone, and click the Insert tab in the ribbon.  Click the Data View drop-down box, and choose EMPTY DATA VIEW.
    ch5[42]
  16. Once you’ve put the empty data view on the page, click the middle of the web part “Click here to select a data source
    ch5[43]
  17. On the data source picker, choose the name of the new XML file you created, and click OK.
    ch5[44]
  18. Notice that now the Data Source Details pane is showing on the right side, something like this:
    ch5[45]
  19. The next thing to do is decide what fields you will want to be displayed in this new web part.  Obviously there are several choices you could look at, but for this post for simplicity’s sake, we’ll just use the “Title” of each site.  So click the Title field and click the <Insert Selected Fields as> button and choose Multiple Item View.
  20. You’ll want the title to be an actual hyperlink, so go ahead and click the name of any of the sites in your web part list.  On the Insert tab, click Hyperlink.
  21. For the address of the hyperlink, choose the URL field and click OK.
    ch5[46]
  22. Obviously at this point you could spend more time making this web part look prettier.  Here are a couple of cosmetic suggestions:
    – Sort the list alphabetically.
    – Click on Paging and choose to display all items (even though there will still be the 50 item limit in the search results web part)
    – Select the cell with the word “title” in it, and delete that cell
    – IF you have multiple web apps such as intranet, public and collaboration, and you only want to show sites that exist in say, the collab portal, you could add a filter here, to say that the URL “contains” and put the URL of the root of the portal. (using a search scope is another option and is mentioned later)
  23. Anyway, we’re almost there.  SAVE this web part page, and open it in the browser.
  24. In the web part properties in the browser, click the XSL Editor button.
    ch5[47]
    Select ALL of the text in there and copy it to the clipboard.
  25. Now, go back to that original web part we started with, the Search Core results web part in the browser.  In this web part’s properties, expand the Display Properties section, and click the <XSL Editor> button.  Erase what’s in there, and PASTE the clipboard in.
  26. SAVE and click OK to save the web part.  DONE
  27. Okay, so now you can export this web part and then cleanly import it onto any site or page in your whole farm.

Paging

Is the 50 item limit a little restrictive for you? You can add the search paging web part to your page, so that people can click to the next page.  The only setting you need to change:  In the Miscellaneous section in the web part properties, change the Cross-Web part Query ID to “Query 2”, just as long as it is the same thing that was selected for the search core results web part in the same setting.
ch5[48]

Search Scope

Note that if you’ve created custom search scopes in search administration, and you’d like to limit the results to only one of them, there’s another setting to note.  In the search core results web part, expand the Location Properties section, and you can just free-form type the name of the scope you’d like to use.

In Summary

All in all, this method of using the search results web part is pretty powerful.  You can use this as GLOBAL NAVIGATION, and you can use it to display a directory of people straight from “people results”.  Read the other associated blogs (listed at the top) for further ideas.  Oh, and there’s even a codeplex project out there http://sctxsl.codeplex.com/ that gives sample code for search results web parts.

90 comments

  • Laura, In our case, we have more than 90% of sites accessible by all with view permission. Is there any way to tweak above approach to list the sites in which user have contribute or more permission.

  • Satheesh, Hmmm, I can’t think of how that could be accomplished.

  • Laura – this is great. Any ideas on how to group by web application?

  • Thanks Laura. The only thing I don’t like about it so far is that when there are more than 50 items the sorting doesn’t seem to work properly, as it is applied AFTER the items are divided into groups of 50 based on the “Modified date” or the “Relevance” option, so on every “page” there are sites beginning with A through Z. Anyone have any ideas on how to resolve that?

  • MOSS does not appear to have Location Visualization as an option. Is there a different way of doing that portion in MOSS?

  • Joe, Yes, you’re right about that behavior, and I’m not sure how you’d get around it. Shawn, You don’t need to worry about that check box in 2007, just skip that step.

  • I created a blog for our commander and would like to place a comment box that holds the Blog Policy and a check box. The reader must read the policy and check the box to submit their comment. I it has been awhile since I’ve done this. Any help would be grateful. Thanks Happy Holidays!

  • subhashinvzm@gmail.com

    Hello, I am new to sharepoint. I need a small favor from every one. My requirement is as described below: I need to maintain a Header form and details from in a single custom list. First form : Reqno, name, department etc.. second form : reqno,sno,item,qty etc.. One to many records will come. so please suggest me , how to do???

  • This post is EXACTLY the kind of thing we desperately need in my organization. I followed the instructions exactly and re-checked several times, but at step 4, I get no results. Any thoughts on why that would happen?

  • Hi Laura This is a nice clear post, thank you. It seems that only the sites i have access to via a sharepoint group or directly, are showing up. If i have access to a site via an AD group, the site doesnt appear in search results 🙁 Ash

  • subhashinvzm, Try reading my 4 part series on the query string url, starting here: http://wonderlaura.com/2010/5/20/query-string-urls-are-like-so-useful-part-1-of-4
    Sean, Try putting only contentclass:STS_Site and see if that gives results? Asher, Wow interesting, I haven’t seen that behavior, but will have to test.

  • Laura, This is a great post, thank you for documenting this. Do you know of a way to scope this to just the current web application and/or to exclude a particular web application from the results. Thanks.

  • Has anyone noticed that paging does not work on the Core Results Webpart?

  • Brandon, Yes, around step 19 when you’re creating the data view web part, you can create a filter in the DVWP to filter the list by the url that you want or don’t want shown in the list. That’s one way. Another way would be to create a custom scope possibly and only query that scope, this would be in the search results web part settings. Oh, and yes you’re right, the paging is very funky.

  • Hi Laura, Your awesome! Your site is the first place I go to to find a SP solution! I’d love to do this but……… Anyway, what’t missing in SP2010 Foundation or Standard Edition that stops me implementing this? Thanks in advance

  • Thanks for the tip, Laura! Yes, in our MOSS environment, I had to take out “contentclass:STS_Web contentClass:sts_listitem_850” to get any results.

  • Dave, “This is an enterprise only solution, because it involves using the search results web part.”

  • it’s not showing me any results in sharepoint 2010

  • Seema, Sorry I don’t know what to tell you. I’ve followed the exact same steps in both 2007 and 2010 and it worked fine in both environments.

  • Hi, thanks for the tip. Any idea how i would get the results in to a drop menu? Any advise would be most welcome!

  • Novak, In SharePoint Designer, when you’re creating the data view web part, on the Design tab there are several style/layouts you can choose from. One of them is a drop-down box.

  • Thanks for the reply, ok i found that. Sorry to be a real pain but a have a couple of questions: 1. Will this drop down be limited to 50 as that is the max when you set the results per page value? 2. How would i get this to jump to the site url when a user selects a value? Any pointers would be great. Or i was thinking, if i create an asp dropdown and link to the siteresults.xml as my datasource, would the security filter still work on this? Sorry for all the questions!

  • If you are site collection admin and need to monitor when users are creating new sub-sites, the RSS feed from the search core results web part can be very handy!

  • Quick one. I have it working with the paging. If i sort it alphabetically and provide paging, it doesn’t work how i would expect. It doesn’t list all the pages alphabetically. Anyone else have this issue?

  • Novak, That drop-down I mentioned. I’ve just seen that it exists as an option, but have never tried it, so I don’t know the answers to your questions. Sean, Good tip!

  • Sorry i am not using the drop down. I am using a the normal default layout. The problem i have is that if i say sort alphabetically and also have the paging, it doesn’t work how it should, it’s like it is creating a page of 50 alphabetically by modified date or relevance. I would just like a normal list that is alphabetical and pages accordingly, any ideas?

  • Hi Laura Great article – thanks. When I just try pasting: contentclass:STS_Site in the fixed keyword qury box I get ‘unable to display web part’ Any ideas?

  • Novak, No, I don’t know. Kevin, When I get errors like that, I usually troubleshoot by trying different combinations of site, web, etc, and trying different searches.

  • Hi Laura, I am new to SharePoint. I went over some of your videso about sum up calculated columns using webpart like the calcuted demo. Now, I have question about how to do calculation field based on the total and group by. For example, Department 1 Purchase Received % Category 1 10 8 80% Category 2 5 3 60% Total 15 11 73% Department 2 Purchase Received % Category 1 8 4 50% Category 2 5 2 40% Total 13 6 46% Grand Total 28 17 61% I can total the count for each category and the %, but I don’t know how to do the Total % and the Grand Total % because it’s calculated by the sum up. Is there any way to do it???

  • Yuyu, I recommend creating just a regular sharepoint list view and use the “totals” feature in there. That way, at least you can get the correct syntax from the code when doing it in a data view web part. Since an out of the box normal view can do this, what is the reason for creating a data view web part?

  • I see at least one other person who posted somewhat recently that they were having problems getting results at step 4 on SP 2010. I tried each individual content class in the fixed content query box and get nothing. Can anyone provide any other suggestions?

  • I have built this web part onto our Collaboration Home Page so that anyone logging in can see what they have access to. But…it only shows a short list. There are only 10 sites listed and the users I have tested this with have access to many more sites. The list changes depending on whether I choose Relevance or Modified Date but still doesn’t show all sites the user has access to. Is there a way to show all?

  • Thank you for the post. It was very helpful and excatly what I needed to complete my clients request. However, I have a question. I added new sites but it is not showing in the webpart. Am I missing something? Does the web part gets updated as the sites are added for the current user? What do I need to do to update the Search Core Result Webpart to show the newly added sites? Please help.

  • Michelle, I would have tried the same exact thing you did, try each content class individually. Next for troubleshooting, I’d try a different keyword in that box, like just some common text like “document” and see if anything shows in the web part. You should see actual search results according to your search word, just as if you were performing any sharepoint search. Selena, At step 2, be sure to change the number of results to 50. Unfortunately, that’s the max number. Kaalie, Each time your search crawl runs, this will update the list. Ask your search administrator how often your sharepoint sites are crawled.

  • i want to add a discussion board in my site i created a discussion board list but i don”t understand which webpart i have to add to my page to show it? thanks

  • Irith, Click to insert a web part, and in the very first category of web parts (lists and libraries), you’ll see the name of whatever you called your discussion board when you created it. Select that and insert it on the page.

  • Thanks for the post . Very good. I followed the steps and did get only 10 results and it doesn’t show me list of all the Sites i have access to. I am getting only 10 results and also does not get show more results link . I have set it to show 50 items and also change it in Designer to “display all itmes”. I have fixed Keyword query set as contentclass:”STS_Site” contentclass:”STS_Web” contentClass:”sts_listitem_850″ also changed it to Custom scope that includes all teh content. Any idea whats going wrong?

  • I got this resolved by changing Display Properties “results sorting ” to Relevance . It gives me list of all sites now however when i click on soem of teh site i get Access Denied . I checked the actual site and user has permission to particular list only , not the whole site ? Is is possible to get URL showing the actual path to the list or Library instaed of just Site colelction name ?

  • Manjiri, Yes, you could change the results to show all lists and libraries that the logged in user has access to, but that would show every single list and library in your whole farm, which would defeat the purpose of having this simple web part to just show a list of sites.

  • Hey Laura, I have a requirement to show Filter and Group By Dropdowns in the DVWP. When I enable this functionality in the DVWP, it doesnt work. Even if it displays the Dropdowns, it doesnot filter or group by the selected value. Any suggestions??

  • This is exactly what we are looking for. But I am trying to get it to work with a scope. But my scope is based off of the contenttype=posts. We want to create a blog center that only displays blog sites that a person has access to. It gives me no results when I add the scope. Also the paging isn’t working but I am seeing others are having the same issue as well. Have you gotten paging to work.

  • Pankaj, I don’t know, I’ve never tried it, but this forum post shows you the code behind these fields if you’d like to take a shot at it: http://social.msdn.microsoft.com/Forums/en/sharepointcustomization/thread/f0a370c1-846f-4d03-88e1-fa43db446a85 Kathy, When you do a search, can you verify that your scope does show results? Before you do any of the settings in my step 2, if you just put the scope in there, does it show results? As far as the paging, no I haven’t gotten any farther with figuring that out.

  • Thanks for replying to quickly. When I do a search it my scope does work. But when just trying to display all sites with any scope except the All Sites scope it displays nothing. Not sure what it could be.

  • Hi Laura, excellent post, but if i want only the blog sites that the user has access then what would be the fixed query. i tried it with BLOG_ Site but it did not work, STS_Site– web template for Team sites Blog_Site for Blog sites ( i assume this) Please help

  • I wanted to display all blogs in the farm. This is how I got it to work. My fixed query now looks like this: “ContentClass:STS_Site AND Blog; ContentClass:STS_Web AND Blog” Paging still doesn’t work but I will have our dev team look at that.

  • Should this resolution also work on BPOS 2007? – as we would like to use this for our Team Sites area.

  • Cindy, Sorry, I don’t know much about BPOS and don’t have any way to test it, but if you do have the search results web part, then I believe you could do this.

  • Hi Laura, Really useful post thanks! I hit the problem that others reported in that I had an error after point 4. I realised I wasn’t able to create an Enterprise Search Site either so enabled the Enterrprise Features and it works nicely now. HTH. J

  • Hi Laura, Nice Post. Can we tweak this webpart to have a list of sites attached to each site collection that we have access to.

  • Deepesh, No, I don’t know how you’d make it show individual sites that the uesr may not have access to.

  • Hi Laura I cam across an odd issue. Already had enterprise features enabled, Followed steps 1 – 4 and clicked ok and get a nice XSLT error .Error while executing web part: System.Xml.Xsl.XslLoadException: XSLT compile error. An error occurred at (0,0). —> System.Xml.XmlException: Root element is missing. at System.Xml.XmlTextReaderImpl.Throw(Exception e) at System.Xml.XmlTextReaderImpl.ParseDocumentContent() … Well after I scratched my head a a few times it occurred to me that I needed to edit the xlst. So followed to step 7 and hey presto … the results returned as raw xml

  • Hi Laura, I can’t seem to get it going. i’m recieving errors after applying your solution (after number 4). can it be because it doesnt work with FAST search?

  • Hey Laura, Thanks for all your help and suggestions. It helped me a lot. I have a question. Is there any way we can link the “Author” field that is displayed in search core results to their corresponding “My Site”? I tried using the managed property to display the author’s username but it does not return any value. Please help. Thanks in advance

  • Laura – Thanks for this solution. The only problem I am having is that when sites are deleted they are still showing up in my list. Any idea why this would happen?

  • Laura – I figured this out, once my search did a full crawl of the site these links were updated / removed. Is it possible to remove the My Memberships tab from my sites?

  • Thanks, very helpful!

  • Ben, If you use FAST search, then you’ll have to use the FAST search core results web part and not the regular search core results web part. I’ve never tried it with FAST, though. Kaalie, There’s probably a way to do that, but I dont’ know the answer as to how to accomplish it. John Ross is an expert on search and these sort of customizations, so maybe you could look on his blog or ask him? Charlie, I’m sure a developer could do that, but it’s not an out of the box type of tweak.

  • hi Laura, I seem to be having issues again. I want to display all blogs a user has access to. When I add my scope which is created off of contenttype=Post. But when I add my scope it displays nothing. Any ideas. I thought I had it working a few weeks ago but then realized that it wasn’t correct.

  • Frank,
    If you’re referring to submitting comments to a blog post, you can just add a new yes/no column to your comments list, and make it default to No, and make it a required field.

    subhashinvzm,
    Create two lists. Make the second list contain a lookup column to the first list. Then, you can read my post about inserting web parts of related lists: http://wonderlaura.com/2010/6/25/sharepoint-related-lists-part-4-of-4
    Sean,
    In the fixed keyword query, I’d try different keywords instead, such as common words, to see if you get results from those. See if actual sites are coming up in any of your results at all.

    Asher,
    Yes, that’s a known bug.

  • Hi Laura. Great post and it looks like something we’d like to do in our organization. This may be a dumb question but after getting down to step 4, I don’t see any results of the search.

    Is there something we need to do to enable the “contentclass” parameters in the search settings? My group doesn’t handle the search area and we’re all very new to SP2010. Thanks.

    Louis

  • Laura

    I am getting weird result from the core search results web part.

    It is not returning all the sub webs; with or without a applying a xslt filter

    variable name=”Rows” select=”/All_Results/Result[contains(url, ‘/NAME_OF_CLIENT/PROJECTWITHSUBWEBS)]”/>

    I have pointed it a client top level site.. I brings back only 4 our 5 sub webs I have created – the 5 sub web is missing. I am sc admin so I should be all the sub webs for the client. I am able to navigate to any of them.

    I can fined the missing sub web if I do a standard search.

    Daniel

  • Laura

    I have sorted it. The messing sites were on placed on the subsequent search results pages. I proved this by a adding the search paging results web part.

    Now I want all my results to appear in the in the first page before I apply xslt filtering. Well this is where I pin pointed my actual URl to search from using a new search scope “name of client”. I would say this is a must .

  • Louis,
    There are some great troubleshooting tips in all of the other comments of this post. Mostly I just recommend putting anything at all in that box instead of all that contentclass stuff. Test it that way. Make sure that search is working and that sites show up in any other regular search that’s being done.

  • Seems to be working well, apart from it pulls up everyones My Site. Any way I can hide these?

  • I have a question related to webpart but was not sure where I can post….Maybe you should create a list where we can post our questions….

    My issues is i have a (single) user who cannot see a webpart in webpart zone but when I move the same webpart to another webpart zone user can see that…there are no target audience, no security permission issue and also check if there are any security applied in web part zone (using SPD)…and there aren’t any…….this is the only user who have this issue….user have contribute permission on the site…..

  • Maybe I should of read it a little better.

    It works wonderfully and no My Sites.

  • Laura,

    Great article! I am sure I will be reading more of them.

    I am assuming if I only put the contentclass:STS_Web in the fixed query string that I will only see sub-sites of the current site collection? or just sub-sites of that current site.

    If I am in the root site collection and all my sites are just sub-sites of that I should hopefully be fine anyways.

    Are these correct assumptions? I am not new to SharePoint but I have never attempted anything quite like this before in SP2010.

    I am using advanced search but was able to get the core results web part going by setting the location properties to local search results.

    My problem is there is literally just too much info when you return all the results

  • Bravo! Thanks for the article!

  • Matt,
    No, if you just use contentclass:STS_Web, you will see ALL subsites, not just those of the current site collection. Whole farm.
    At step 22, I show that you can put a filter in there.

  • Matthew Dodson

    Hi Laura,
    great article 🙂
    Tried it in my dev environment, but everytime I entered a value in the fixed keyword query (regardless what contentclass) I get an error with a correlation id (that can’t be found in the logs) saying that this webpart can’t be displayed.
    Any idieas?
    Regards,
    Matthew

  • Matthew,
    Does the web part show any results with the fixed keyword query as blank?

  • Nice post Laura. When you are not wondering about stuff, you must be writing.

    Have you wondered about showing only sites that you are a member of? Maybe searching for all content you have created and\or modified and then displaying only the site title as a link with no duplicates. Maybe modifying the security trimming to display only results where you have contribute. I will mull it over and talk to SP Pals for ideas.

    Thanks – I enjoy your posts and your books,

    Greg

  • Laura I love your posts but this does not work for me in 2010 either.

  • Error was unable to display webpart and correlation error

  • I had issues initially getting the search results webpart to display any results on Step 4. One of the issues might be a security timeout that Microsoft so helpfully included in a SharePoint Service Pack:
    http://englando.wordpress.com/2012/01/05/unable-to-display-this-web-part-xsltlistview-and-xsltdataview-web-part-issues-in-ie/

    So if you get to step 4 and get the following message:
    “Unable to display this Web Part. To troubleshoot the problem, open this Web page in a Microsoft SharePoint Foundation-compatible HTML editor such as Microsoft SharePoint Designer. If the problem persists, contact your Web server administrator.”

    Try editing the search results webpart and re-check the Location Visualization checkbox, hit OK. Refresh the page and you should now see results listed on the page. Edit the webpart again, and now uncheck the Location Visualization checkbox, click OK. Refresh the page, and now it should work.

  • Thanks for the excellent article Laura!

    My one suggestion would be to change the Fixed Keyword Query in Step 3 to remove “contentClass:sts_listitem_850”. That content class seems to display all enterprise wiki pages.

    Thanks.

  • Great post Laura! Thanks for that. Just recently started to follow your Blog.

    ps: Its a shame only 50 results can be displayed at a time. Using the page webpart doesn’t feel user friendly.

  • Is there a way to display only the different Site Collections? When I use this, it displays a couple site collections, along with a few My Sites.

  • I should have mentioned in my previous post, I am only using STS_Site

  • Hi Laura,
    This tutorial was very helpful.

    I am running into 1 issues though. When I create the web part and store the XML as a datasource and create a dataview web part with that data source, the content displays as it should. The problem I am having is that when I create a new site collection, it does NOT show up in this web part?

    It shows up in the original web part (search core results) but the dataview web part which is on a different page is not updated with the new site collections.

  • Hi Laura,

    My company is using this method to display all sites that a user has access to. It shows up whether you’re an owner, member or visitor.

    Our next step is to create a new listing where you are only an owner or member (and hide the sites where you are a visitor).

    Is there an easy way to do this by modifying any parameters?

    Thanks again – great posts.

    Louis

  • Hi Laura

    Excellent post.

    Just a quick question, I have a customer that has numerous site collections and I want to filter the results to for instance only their Forums site collection? The sites within that site collection uses Custom Site templates, do I need to add those to the initial contentclass and if so how do you go about that?

    Thanks
    Phillip

  • Hi Laura

    Another question, if the sites changes would this webpart update accordingly or would you have to do an export of the Results.xsl every time?

  • This is a great tutorial.

    One problem remains for me though: The paging on the Searc Core Results web part still does not work. Paging works fine in DataView web part, sure, but the DVWP is just a temporary object used to build XSL that you then plug back into the original Search Core Results web part.

    Has anyone gotten paging in the Search Core to work? If so, did it ‘just’ work from the get go, or did you find a configuration or hack you had to do to make it work.

    Phillip: The use of the searchresults.xml (in the DataView web part portion of the exercise) was simply for you to craft specific XSL you want to display. That searchresults.xml is throwaway, once you have migrated your finished XSL back into the Search Core Results web part. The Search Core Results web part is the finished product of this tutorial, and will automatically pick up and render new SharePoint sites that the user has permissions to.

  • Justin,
    Try step 22… add a filter there to only show the location you want, or exclude a location.

    J Cooper,
    Sorry I’ve never seen that happen, and it doesn’t seem to make any logical sense. As long as you haven’t put any filters (step 22) in your web part, there isn’t any reason it wouldn’t show something, unless that site hadn’t been indexed yet.

    Louis,
    No, as long as you have at least read access to a site, it will show up in your search results.

    Phillip,
    I don’t know if you’d have to add to the web part properties for new templates, I doubt it. I’d just test it without changing the web part. Run a crawl and see if those sites show up. Also, no you wouldn’t ever need to modify this web part once it’s in place. As soon as sites are indexed, they’ll show up.

    Sean,
    No I haven’t learned anything further about the paging.

  • HI Laura great article. I had the same problem some where having after step 4 but i just continued and finish the tutorial and eventually my results were displayed. My only problem is trying to pull additional metadata in the search such as the site collection admin , date created, etc. Do you know where i can find the multiple properties to gather this information on top of the sites you have access to? or if this even possible.

    I found this link (http://www.rtsmedia.com/SharePoint/contentclass.aspx)
    but dosn’t seem to give me what i need.

    Thanks!

  • Brandon,
    I’m not sure where that metadata would come from. If you’re retrieving something like documents, the fields like “created by” and “created” are obvious, but I don’t know if there’s anything like that at the site level.

  • Hi Laura,

    I want a site where user is having exclusive permission (full permission/contribute/read). I’m using search scope

  • spuser,
    I’m not sure what you’re asking. Are you asking to only see a list of sites where the logged in user has a certain permission level? I haven’t figured out if there’s a way to do that. In SharePoint 2013 / Office 365, using the content search web part, there’s a way to make your query only show sites and web, and there’s an author field or a created by field you could try:
    contentclass:STS_Web contentclass:STS_Site Author={User.Name}

  • Kjell Bekkerell

    Hi Laura.
    Thanks for a great post. Very useful.
    I realize this is an old post, but I see that you have answered not to long ago so I give it a shot.

    We use your technique to display documents in a list with additional columns of metadata.
    We have enabled the “Sort & Filter on Headers” under the “Design” tab in Sharepoint Designer.
    Both sorting and filtering is working well in the DVWP but when we copy the XML to the Search Core Results web part,
    only filtering is working. Sorting is not working.
    Do you know how to get the sorting working in the SCRWP?
    Btw. We are still using SP2010.

    PS. For those that have problems with the paging.
    Simply disable paging in the DVWP and add a “Search Paging” web part to the page instead.

Leave a Reply