6

In my development I just recently noticed the attribute "doGUIDFixUp = TRUE|FALSE".

I tried to google more about this attribute but couldn't find anything useful. The MSDN site doesn't explain this either.

Can someone shed some light as to what this field would be used for?

6

Setting DoGuidFixUp="TRUE" for a <File> tag allows you to use tokens {$ListId: WebRelativeListUrl;} inside the deployed file. Those tokens will be replaced with the GUID of the list defined by the "WebRelativeListUrl" URL. Very useful when deploying webparts, pages with webparts, etc.

Example:

<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/" >
  <Module Name="Calendar" List="113" Url="_catalogs/wp">
    <File Path="Calendar\Calendar.webpart" Url="Calendar.webpart" Type="GhostableInLibrary" DoGUIDFixUp="TRUE" >
      <Property Name="Group" Value="Custom" />
    </File>
  </Module>
</Elements>

This code will deploy "Calendar.webpart" file to the site webparts gallery.

Inside the Calendar.webpart, I have the following code:

<webParts>
  <webPart xmlns="http://schemas.microsoft.com/WebPart/v3">
    <metaData>
      <type name="Microsoft.SharePoint.WebPartPages.XsltListViewWebPart, Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" />
      <importErrorMessage>Cannot import this Web Part.</importErrorMessage>
    </metaData>
    <data>
      <properties>
        ...
        <property name="ListName" type="string">{$ListId: Lists/Calendar;}</property>
        ...
      </properties>
    </data>
  </webPart>
</webParts>

After it is provisioned, I can see the token is replaced with correct list GUID.

| improve this answer | |
  • Very useful. Do you know the exhaustive list of working tokens? – Steve B Jul 1 '15 at 14:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.