Quantcast
Channel: SharePoint 2013 - Development and Programming forum
Viewing all articles
Browse latest Browse all 7589

Poweshell SharePoint BypassLocks attempting to perform an unauthorised operation

$
0
0

I get the following error when I try to run:

Powershell ByPassLocks

Exception calling "BypassLocks" with 2 argument(s) attempting to perform an unauthorized operation.

I am just wondering how I can resolve this?

           $recordsmanagement=[Microsoft.Office.RecordsManagement.RecordsRepository.Records]

                          $ChangeRecord = {
                          param( [Microsoft.SharePoint.SPListItem] $listItem)
                          $MMSField.SetFieldValue($listItem,$spTerm); 
                          $listitem.SystemUpdate() 
                       }

$sysId = $webUrl.Site.SystemAccount.ID
$sysuser = $web.AllUsers[$sysId]
$token = $sysuser.Token
#Create New Site Object under Token of System Account for the Site Collection
$newSiteObject = New-Object Microsoft.SharePoint.SPSite($web.Url, $token)
$newWebObject = $newSiteObject.OpenWeb()
#$item = $newWebObject.GetListItem($fileurl)       

                        #pass the delegate to the By Pass locks API
                        $recordsmanagement::bypasslocks($listItem, $ChangeRecord)

Any idea how this can be resolved?                 


faye fouladi




Viewing all articles
Browse latest Browse all 7589

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>