Thursday, August 6, 2015

How to Modify Approval Status or content Approval column Blog posts list update in SharePoint powershell

 1.Disable >>>>>>>List Settings >Version Settings> Content Approval Option...
2.After run powershell.If you run powershell script May be powershell script wont work....



Failed to get value of the "Approval Status" column from the "Moderation Status" field type control


Column Name: _ModerationStatus
Type :ModStat



$site = Get-SPSite "http://raghupc/"
$web = $site.OpenWeb("test/blog")
$list = $web.Lists["Posts"]
$items = $list.GetItems()

foreach ($item in $items)
{
write-host $item["Title"] $item["_ModerationStatus"]
write-host $item["ID"]
#$item["_ModerationStatus"] =0


    $item.Update()
}
$list.Update();
$web.Update();
$web.Dispose();
$site.Dispose();



<Field ID="{fdc3b2ed-5bf2-4835-a4bc-b7d1a6396a61}" 
       ReadOnly="FALSE" 
       Type="ModStat" 
       Name="_ModerationStatus" 
       StaticName="_ModerationStatus"
       DisplayName="Approval Status" 
       Hidden="FALSE" 
       CanToggleHidden="TRUE" 
       FromBaseType="TRUE"
      Required="TRUE" 
       SourceID="http://schemas.microsoft.com/sharepoint/v3">
  <CHOICES>
    <CHOICE>0;#Approved</CHOICE>
    <CHOICE>1;#Rejected</CHOICE>
    <CHOICE>2;#Pending</CHOICE>
    <CHOICE>3;#Draft</CHOICE>
    <CHOICE>4;#Scheduled</CHOICE>
  </CHOICES>
  <Default>2</Default>
</Field>

No comments:

Post a Comment