Replies: 2 comments 1 reply
-
Hi, I have the same issue. Were you able to fix it? Kind Regards, |
Beta Was this translation helpful? Give feedback.
1 reply
-
Hi, I solved it this way; if($Error[0].Exception.Message -like "3afcc5c7-c6ef-44f8-9479-3561d72f9e8e" ){ |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
I am working on a PnP-based site provisioning script that uses a site configuration file (XML-based) extracted via Get-PnPSiteTemplate and applies that template to a new site via Invoke-PnPSiteTemplate. In the source site I have two libraries configured, along with a couple of views. Features enabled on the source site include the Document ID and In Place Records Management features.
The application of the template to the target site works fine (no errors), and the libraries get created and the features are activated as expected. As part of an extension to the provisioning I am now trying to programmatically update my predefined views to include the 'Declared Record' column ... however, this column is not available until AFTER the first time a record has been declared (it get's dynamically added to lists/libraries by the In Place Rec Mgmt feature the first time you declare a record.
So what I was going to do it is (as part of my provisioning script) programmatically upload a file to my libraries, then use Set-PnPListItemAsRecord to declare that item as a record, then clear the record using Clear-PnPListItemAsRecord, and then delete the file. Then I was going to update my views to include the additional column. Unfortunately, when I call Set-PnPListItemAsRecord I get this error:
Set-PnPListItemAsRecord : Invalid field name. {3afcc5c7-c6ef-44f8-9479-3561d72f9e8e} /sites/TargetSite17/KEEPit Document
At C:\temp\Novo\Provisioning.ps1:214 char:5
The GUID of the field it is referring to matches a GuID in the template XML that I use (which came from my template site).
In the log for the template application I also see that the field is (apparently) properly deployed
PowerShell_ISE.exe Information: 0 : 2022-09-02 17:02:17.1291 [Fields] [16] [Debug] Updating field {3AFCC5C7-C6EF-44f8-9479-3561D72F9E8E} in site 3746ms 68df07d4-2a32-435f-a7b3-0614de36c6cc
However, Set-PnPListItemAsRecord apparently cannot find this field. Any idea what is going on here? Am I missing a step/component somewhere that is not obvious?
Note that I am able to use Set-PnPListItemAsRecord as described above to declare a record in the template site, so i know the template site is properly configured to allow declaring records ... just not the new sites generated via the template.
Any assistance/ideas appreciated.
Thanks
Beta Was this translation helpful? Give feedback.
All reactions