Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $User = "admin@****.onmicrosoft.com"
- $SiteURL = "https://***.sharepoint.com/sites/**** #enter site collection url"
- #Add references to SharePoint client assemblies and authenticate to Office 365 site – required for CSOM
- Add-Type -Path "C:Program FilesCommon FilesMicrosoft SharedWeb Server Extensions15ISAPIMicrosoft.SharePoint.Client.dll"
- Add-Type -Path "C:Program FilesCommon FilesMicrosoft SharedWeb Server Extensions15ISAPIMicrosoft.SharePoint.Client.Runtime.dll"
- $Password = Read-Host -Prompt "enterpassword" -AsSecureString
- $Creds = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($User,$Password)
- #Bind to site collection
- $Context = New-Object Microsoft.SharePoint.Client.ClientContext($SiteURL)
- $Creds = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($User,$Password)
- $Context.Credentials = $Creds
- $fieldTitle = "AutomaticallyCreated"
- $customfield = $Context.Site.RootWeb.Fields.GetByInternalNameOrTitle($fieldTitle)
- $customfield.ShowInEditForm($true)
- $customfield.ShowInDisplayForm($true)
- $customfield.UpdateAndPushChanges($true)
- $Context.ExecuteQuery()
- Method invocation failed because [Microsoft.SharePoint.Client.Field] doesn't
- contain a method named 'ShowInEditForm'.
- At line:1 char:1
- + $customfield.ShowInEditForm($true)
- + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- + CategoryInfo : InvalidOperation: (:) [], RuntimeException
- + FullyQualifiedErrorId : MethodNotFound
- Method invocation failed because [Microsoft.SharePoint.Client.Field] doesn't
- contain a method named 'ShowInDisplayForm'.
- At line:1 char:1
- + $customfield.ShowInDisplayForm($true)
- + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- + CategoryInfo : InvalidOperation: (:) [], RuntimeException
- + FullyQualifiedErrorId : MethodNotFound
Add Comment
Please, Sign In to add comment