Approve Files

Approves a list of files contained within the list.

Reference Information
Release Status : Beta
Alias Name : Action.ApproveFile
Full Reference Name : Collaboris.Saf.Actions.Wss.File.ApproveFiles
Assembly Name : Collaboris.Saf.Actions.Wss
Remarks : Please note. The undo currently performs no action.
Undo Implementation? : This action has no Undo implementation.
Download Samples for ApproveFiles : Collaboris.Saf.Actions.Wss.File.ApproveFiles.zip
Download Samples for ALL Actions : AllSamples.zip

Properties
Name Description Example Value Output Required
DisableDo Boolean. Determines whether to disable the 'Do' on the Action. If 'DisableDo' is set to 'True' then the action will be skipped. false false false
DisableUndo Boolean. Determines whether to disable the 'Undo' on the Action. If 'DisableUndo' is set to 'True' then the action will be skipped. false false false
EntityList Defines an array of Collaboris.Saf.Actions.Wss.Entities.ApproveFileInfo.

Note :
Entities are the method in which parameters can be supplied to the Action. Many instances of an entity can be passed in. (Please see the XML examples to understand how to configure an entity with values).
Please refer to the documented types for samples. false false
ID Guid. A unique identifier for the instance of the action. If an ID is not supplied then SAF will create a new one. {47B640DD-64A9-493b-8445-789FC0D05FF1} false true
StopOnDoException Boolean. A bool indicating whether to stop processing if an exception is encountered during the 'Do' operation of the Action. true false false
StopOnUndoException Boolean. A bool indicating whether to stop processing if an exception is encountered during the 'Undo' operation of the Action. true false false

ApproveFiles Examples

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.Wss.File.ApproveFiles.macroTemplate">
      <disabledo>false</disabledo>
      <disableundo>false</disableundo>
      <fileurls>
        <ArrayOfString type="System.Collections.Generic.List`1[[System.String]]">
          <string>${CurrentWeb.Url}/Pages/default.aspx</string>
        </ArrayOfString>
      </fileurls>
      <approvecomments>Approved by a SAF action.</approvecomments>
      <id>{47B640DD-64A9-493b-8445-789FC0D05FF1}</id>
      <stopondoexception>true</stopondoexception>
      <stoponundoexception>true</stoponundoexception>
      <Url>http://localhost:4422</Url>
      <InstanceId>{{156E17A5-A7BA-4e1f-8A48-1BC341A7C644}}</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="{3a963042-fad4-4a13-99ea-dd7ea8b5ae46}" />
    <constructor-arg name="actions">
      <list element-type="IAction">
        <object id="ApproveFiles0f" type="Action.ApproveFile" lazy-init="true">
          <property name="DisableDo" value="false" />
          <property name="DisableUndo" value="false" />
          <property name="EntityList">
            <object id="ApproveFileInfo59" type="Entity.ApproveFileInfo" lazy-init="true">
              <property name="FileUrls">
                <list element-type="string">
                  <value>${CurrentWeb.Url}/Pages/default.aspx</value>
                </list>
              </property>
              <property name="ApproveComments" value="Approved by a SAF action." />
            </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="{0d3b76c6-e10d-4ee5-8f01-c65b39866868}" />
    <constructor-arg name="actions">
      <list element-type="IAction">
        <object id="ApproveFiles4e" type="Action.ApproveFile" lazy-init="true">
          <property name="DisableDo" expression="Func.Eval('${disabledo}')" />
          <property name="DisableUndo" expression="Func.Eval('${disableundo}')" />
          <property name="EntityList">
            <object id="ApproveFileInfoa2" type="Entity.ApproveFileInfo" lazy-init="true">
              <property name="FileUrls" expression="Func.Eval('${fileurls}')" />
              <property name="ApproveComments" expression="Func.Eval('${approvecomments}')" />
            </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="{156E17A5-A7BA-4e1f-8A48-1BC341A7C644}" Title="SAF Sample Feature - 'Action.ApproveFile'" Description="Sample Feature illustrating how to call and run 'ApproveFiles' 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.Wss.File.ApproveFiles.macroTemplate" />
    <Property Key="InstanceId" Value="{156E17A5-A7BA-4e1f-8A48-1BC341A7C644}" />
    <Property Key="disabledo" Value="false" />
    <Property Key="disableundo" Value="false" />
    <Property Key="fileurls" Value="&lt;ArrayOfString type=&quot;System.Collections.Generic.List`1[[System.String]]&quot;&gt; &lt;string&gt;${CurrentWeb.Url}/Pages/default.aspx&lt;/string&gt;&lt;/ArrayOfString&gt;" />
    <Property Key="approvecomments" Value="Approved by a SAF action." />
    <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.Wss.File.ApproveFiles.macroTemplate -mode "do" -url http://localhost:4422 -disabledo "false" -disableundo "false" -fileurls "&lt;ArrayOfString type=&quot;System.Collections.Generic.List`1[[System.String]]&quot;> &lt;string>${CurrentWeb.Url}/Pages/default.aspx&lt;/string>&lt;/ArrayOfString>" -approvecomments "Approved by a SAF action." -id "{47B640DD-64A9-493b-8445-789FC0D05FF1}" -stopondoexception "true" -stoponundoexception "true"