Geeks With Blogs

Locations of visitors to this page
Michael Van Cleave Traveling the technical world, learning the language

Currently I am working on a site definition project that has been very entertaining and also had some pretty interesting challenges.

Overall the project is going very smoothly utilizing all of the same techniques I teach from the Inside Windows SharePoint Services 3.0 course at AmeriTeach. But I recently ran in to a very interesting situation in which I was provisioning a web part page with webparts via CAML.

Here is a sample of the CAML that is used for provisioning the page with a webpart:

<File Url="Pages\WebpartPage.aspx" Name="Overview.aspx" Type="GhostableInLibrary" IgnoreIfAlreadyExists="TRUE">

<AllUsersWebPart WebPartZoneID="Center" WebPartOrder="0">

        <![CDATA[ {webpart info goes here}]]>

    </AllUsersWebPart>

</File>

If you notice, on my File element I have IgnoreIfAlreadyExists set to TRUE. Pretty much what this is telling me is that if the page already exists in the library that I am provisioning this to then it will skip over this entry and ignore everything that is inside of it. Well that is not quite the case.

In my situation I was provisioning a lot of pages that looked essentially the same but had different names and content in some content editor webparts. So in an effort to save some time I just cut and pasted about 15 of the same entry over and over again then went back and changed the Name attribute of the File element. It seemed to work like a champ, except I didn't notice that I had one extra entry that I didn't change the name and it was a duplicate of the initial page entry I had copied.

In effect I had 2 of the same entries with the Ignore attribute set to TRUE, but the effect was that the page was not duplicated; however the webparts that were to be provisioned ended up being provisioned twice on the one page that was provisioned.

So to sum it all up, if you are provisioning pages and you have the IgnoreIfAlreadyExists attribute set to true then it will not overwrite the page if it already exists, but it will not affect the provisioning of the webparts on the page.

Michael

Posted on Tuesday, July 29, 2008 4:42 PM SharePoint | Back to top


Comments on this post: Duplicate Provisioning of Webparts

No comments posted yet.
Your comment:
 (will show your gravatar)


Copyright © Michael Van Cleave | Powered by: GeeksWithBlogs.net