Adds or Updates a field to a specific page in the 'Pages' library for the current web.
This example illustrates how to call a Templated Macro from an MSBuild project. (Please see the 'Templated Macro' tab.)
<?xml version="1.0" encoding="utf-8"?>
<!-- Defines a 'SAF Macro' containiing 'Actions' to be run on 'Do' and 'Undo' -->
<!-- Please visit http://www.collaboris.co.uk/Saf/Doc/default.html for more information. -->
<Project DefaultTargets="Do" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<UsingTask AssemblyName="Collaboris.Saf, Version=2.0.0.0, Culture=neutral, PublicKeyToken=182db3eac6a9e195" TaskName="Collaboris.Saf.Adapters.MSBuild.SAF" />
<ItemGroup>
<Macros Include="Collaboris.Saf.Actions.Moss.Publishing.UpdatePublishingPageFields.macroTemplate">
<disabledo>false</disabledo>
<disableundo>false</disableundo>
<pagerelativeurl>Pages/Default.aspx</pagerelativeurl>
<fields>
<Dictionary type="Collaboris.Utils.SerializableObjectDictionary`1[[System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]">
<item type="System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<key>
<string>StringKey1</string>
</key>
<value>
<string>AStringValue</string>
</value>
</item>
<item type="System.Int32, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<key>
<string>IntKey1</string>
</key>
<value>
<int>3</int>
</value>
</item>
<item type="System.Collections.Generic.List`1[[System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]], mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<key>
<string>ListKey1</string>
</key>
<value>
<ArrayOfString xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<string>string 1</string>
<string>string 2</string>
</ArrayOfString>
</value>
</item>
</Dictionary>
</fields>
<id>{47B640DD-64A9-493b-8445-789FC0D05FF1}</id>
<stopondoexception>true</stopondoexception>
<stoponundoexception>true</stoponundoexception>
<Url>http://localhost:4422</Url>
<InstanceId>{{4200abc5-8acc-428e-a3b2-656d7a4f2b02}}</InstanceId>
</Macros>
</ItemGroup>
<Target Name="Do">
<SAF MacroPaths="@(Macros)" ProcessMode="Do" ContinueOnError="false" />
</Target>
<Target Name="Undo">
<SAF MacroPaths="@(Macros)" ProcessMode="Undo" ContinueOnError="false" />
</Target>
</Project>
This example illustrates how to create a macro directly with values inserted.
<?xml version="1.0" encoding="utf-8"?>
<objects xmlns="http://www.springframework.net" default-lazy-init="true">
<object id="MacroToProcess" type="Macro">
<constructor-arg name="templateid" value="{c5b582cf-afb3-4528-9beb-7cc95d8cad92}" />
<constructor-arg name="actions">
<list element-type="IAction">
<object id="UpdatePublishingPageFieldsa0" type="Action.UpdatePublishingPageFields" lazy-init="true">
<property name="DisableDo" value="false" />
<property name="DisableUndo" value="false" />
<property name="EntityList">
<object id="PublishingPageFieldsInfo29" type="Entity.PublishingPageFieldsInfo" lazy-init="true">
<property name="PageRelativeUrl" value="Pages/Default.aspx" />
<property name="Fields">
<object type="SafStringDictionary">
<constructor-arg name="dictionary">
<dictionary>
<entry key="Description" value="Some Description" />
<entry key="Scheduling Start Date">
<value type="date">10/10/2015 12:12:00</value>
</entry>
<entry key="Page Content">
<value type="string">Collaboris Image : <img src="http://www.collaboris.co.uk/App_Themes/CollaborisWeb/Images/Logo4.jpg"></value>
</entry>
</dictionary>
</constructor-arg>
</object>
</property>
</object>
</property>
<property name="ID" value="{47B640DD-64A9-493b-8445-789FC0D05FF1}" />
<property name="StopOnDoException" value="true" />
<property name="StopOnUndoException" value="true" />
</object>
</list>
</constructor-arg>
</object>
</objects>
This example illustrates how to create the Macro as a template, (so that it can be called via MSBuild or a Feature).
<?xml version="1.0" encoding="utf-8"?>
<objects xmlns="http://www.springframework.net" default-lazy-init="true">
<object id="MacroToProcess" type="Macro">
<constructor-arg name="templateid" value="{c3a60d46-34a9-43ab-83f2-2d9816a9085a}" />
<constructor-arg name="actions">
<list element-type="IAction">
<object id="UpdatePublishingPageFieldsb4" type="Action.UpdatePublishingPageFields" lazy-init="true">
<property name="DisableDo" expression="Func.Eval('${disabledo}')" />
<property name="DisableUndo" expression="Func.Eval('${disableundo}')" />
<property name="EntityList">
<object id="PublishingPageFieldsInfoe5" type="Entity.PublishingPageFieldsInfo" lazy-init="true">
<property name="PageRelativeUrl" expression="Func.Eval('${pagerelativeurl}')" />
<property name="Fields" expression="Func.Eval('${fields}')" />
</object>
</property>
<property name="ID" expression="Func.Eval('${id}')" />
<property name="StopOnDoException" expression="Func.Eval('${stopondoexception}')" />
<property name="StopOnUndoException" expression="Func.Eval('${stoponundoexception}')" />
</object>
</list>
</constructor-arg>
</object>
</objects>
This example illustrates how to call a Templated Macro from a Feature Receiver. (Please see the 'Templated Macro' tab).
<?xml version="1.0" encoding="utf-8"?>
<Feature Id="{4200abc5-8acc-428e-a3b2-656d7a4f2b02}" Title="SAF Sample Feature - 'Action.UpdatePublishingPageFields'" Description="Sample Feature illustrating how to call and run 'UpdatePublishingPageFields' from a SAF Macro." Version="12.0.0.0" Hidden="FALSE" Scope="Web" DefaultResourceFile="core" xmlns="http://schemas.microsoft.com/sharepoint/" ReceiverAssembly="Collaboris.Saf, Version=2.0.0.0, Culture=neutral, PublicKeyToken=182db3eac6a9e195" ReceiverClass="Collaboris.Saf.Adapters.SafFeatureReceiver">
<Properties>
<!-- Defines a SAF Macro containiing Actions to be run on Do and Undo -->
<!-- Please visit http://www.collaboris.co.uk/Saf/Doc/default.html for more information. -->
<Property Key="MacroFile" Value="Collaboris.Saf.Actions.Moss.Publishing.UpdatePublishingPageFields.macroTemplate" />
<Property Key="InstanceId" Value="{4200abc5-8acc-428e-a3b2-656d7a4f2b02}" />
<Property Key="disabledo" Value="false" />
<Property Key="disableundo" Value="false" />
<Property Key="pagerelativeurl" Value="Pages/Default.aspx" />
<Property Key="fields" Value="<Dictionary type="Collaboris.Utils.SerializableObjectDictionary`1[[System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]">
 <item type="System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
 <key>
 <string>StringKey1</string>
 </key>
 <value>
 <string>AStringValue</string>
 </value>
 </item>
 <item type="System.Int32, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
 <key>
 <string>IntKey1</string>
 </key>
 <value>
 <int>3</int>
 </value>
 </item>
 <item type="System.Collections.Generic.List`1[[System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]], mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
 <key>
 <string>ListKey1</string>
 </key>
 <value>
 <ArrayOfString xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
 <string>string 1</string>
 <string>string 2</string>
 </ArrayOfString>
 </value>
 </item>
 </Dictionary>" />
<Property Key="id" Value="{47B640DD-64A9-493b-8445-789FC0D05FF1}" />
<Property Key="stopondoexception" Value="true" />
<Property Key="stoponundoexception" Value="true" />
<!-- You can also define your own properties to be resolved by PlaceHolders in the Macro ... <Property Key="YourKey" Value="YourValue" /> -->
</Properties>
</Feature>
This example illustrates how to call a Templated Macro from a custom Saf StsAdm Command. (Please see the 'Templated Macro' tab).
REM Defines a SAF Macro containiing Actions to be run on Do and/or Undo
REM Please visit http://www.collaboris.co.uk/Projects/SafWiki/SAF_WIKI/Contents_Page.aspx for more information.
REM IMPORTANT! If this macro needs a SharePoint context please amend the '-url http://localhost:4422' argument (below).
REM
REM If the macro DOESN'T require a SharePoint context, simply remove the '-url http://localhost:4422' argument.
SET STSADM=C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\bin\stsadm.exe
"%STSADM%" -o saf-run -macrofile Collaboris.Saf.Actions.Moss.Publishing.UpdatePublishingPageFields.macroTemplate -mode "do" -url http://localhost:4422 -disabledo "false" -disableundo "false" -pagerelativeurl "Pages/Default.aspx" -fields "<Dictionary type="Collaboris.Utils.SerializableObjectDictionary`1[[System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]">
<item type="System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<key>
<string>StringKey1</string>
</key>
<value>
<string>AStringValue</string>
</value>
</item>
<item type="System.Int32, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<key>
<string>IntKey1</string>
</key>
<value>
<int>3</int>
</value>
</item>
<item type="System.Collections.Generic.List`1[[System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]], mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<key>
<string>ListKey1</string>
</key>
<value>
<ArrayOfString xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<string>string 1</string>
<string>string 2</string>
</ArrayOfString>
</value>
</item>
</Dictionary>" -id "{47B640DD-64A9-493b-8445-789FC0D05FF1}" -stopondoexception "true" -stoponundoexception "true"