Problem with adding TagCloud web part to site definition/onet.xml with userscope
-
10-12-2019 - |
Question
I'm trying to add a Tag cloud web part to my site definition's onet.xml file and set its userscope to everything under the current url.
I understood from Microsoft I cannot simply export and import the web part because its not supported by v3 schema (its not a asp.net based web part). I exported a DWP file from the web part gallery and added it to my onet.xml and everything is fine.
The problem is I cannot understand how to set the userscope using the v2 schema. In v3 its quite simple. You have a parameter called UserScope and there sits the definition. In v2 i tried all the following settings without any success:
<TagCloudUserScope>Microsoft.SharePoint.Portal.WebControls.TagCloudUserScope.UnderUrlEveryone</TagCloudUserScope>
<TagCloudUserScope>UnderUrlEveryone</TagCloudUserScope>
<UserScope>Microsoft.SharePoint.Portal.WebControls.TagCloudUserScope.UnderUrlEveryone</UserScope>
<UserScope>UnderUrlEveryone</UserScope>
Solution
I'm sure you found a workaround for this by now. I'm posting this for anyone still looking for the answer. All you need to do is use the correct namespace: "urn:schemas-microsoft-com:sharepoint:TagCloudWebPart
"
<UserScope xmlns="urn:schemas-microsoft-com:sharepoint:TagCloudWebPart">UnderUrlEveryone</UserScope>
OTHER TIPS
Is there a reason you need to use site definitions? Site Definitions are generally a bad idea and introduce real dependency issues over time. Using WebTemplates are almost always a better idea.
here are a few good resources:
http://msdn.microsoft.com/en-us/library/aa979709(v=office.14).aspx
http://blogs.msdn.com/b/vesku/archive/2010/10/14/sharepoint-2010-and-web-templates.aspx
There are a lot of advantages, but the main one is that you can get the same level of customization without introducing a dependency to the custom site definition, instead it will reference a standard site definition making the upgrade and maintenance process easier.
Typically I'll add the web parts to the page as part of a feature receiver using the object model.