IgnoreIfAlreadyExists attribute when provisioning files in SharePoint

The IgnoreIfAlreadyExists attribute of a File element when provisioning a file can be mysterious. Most of the posts on the net are saying that:

  • When this attribute is set to FALSE, an error will be thrown if the file already exists at the targeted location
  • When set to TRUE, an error will not be thrown if the file already exists, but the existing file will not be updated.
I tested this with ghostable files and found that this is not quite true. My tests showed that:

  • When set to FALSE, an error is raised if the file already exists
  • When set to TRUE, no error is raised, and the existing file is updated if it has not been unghosted (e.g. customised post deployment using SharePoint Designer). The file is not updated if it has been unghosted/customised.
I tested this with files deployed to the master pages and page layouts gallery and the Type attribute was GhostableInLibrary.
Advertisement

About Bernado

Based in Australia, I am a freelance SharePoint and Dynamics CRM developer. I love developing innovative solutions that address business and everyday problems. Feel free to contact me if you think I can help you with your SharePoint or CRM implementation.
This entry was posted in SharePoint 2010. Bookmark the permalink.

1 Response to IgnoreIfAlreadyExists attribute when provisioning files in SharePoint

  1. Pingback: SharePoint 2013: Updating MasterPages and Page Layouts – using Feature | Amjad Khan

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s