Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE] Added Retention Label options to Set-PnPListItem #3397

Closed
wants to merge 3 commits into from

Conversation

danielcecil
Copy link
Contributor

Type

  • Bug Fix
  • New Feature
  • Sample

Related Issues?

Adds the option to specify a user email and date when setting a Retention Label (ComplianceTag) to List Items.

What is in this Pull Request ?

Added two new parameters to the 'Single' param set in Set-PnPListItem to take a LabelAppliedByUser string and LabelAppliedDate DateTime object.

Forking in the logic that when the user email is specified then use a different CSOM call (SetComplianceTagWithMetaInfo) using provided values, and values from the ComplianceTag configuration (e.g. BlockDelete, BlockEdit, etc). AppliedDate defaults to current time when not specified as is the default behavior.

Updated documentation with 1 new example and additional parameter descriptions.

@gautamdsheth I know you recently tidied up some of the code around ComplianceTags so keen to hear your thoughts on the additional options to set a ComplianceTag with additional metadata.

@gautamdsheth
Copy link
Collaborator

hi @danielcecil , code-wise it looks good.

I read this post, where it says: It is strongly recommended to use SetComplianceTagOnBulkItems instead of these methods. The CSOM method SetComplianceTagWithMetaInfo is also marked for deprecation, and they recommend using SetComplianceTagOnBulkItems method.

So, don't think we should start adding a method marked for deprecation.

Also, checking with @martinlingstuyl , maybe he has some thoughts on this ?

@martinlingstuyl
Copy link
Contributor

Yes, you're a 100% correct @gautamdsheth, you should be using the bulk items method for this. I believe it's already in the PnP codebase @danielcecil, but if you can't find it or want to read the idea behind the deprecation, do check out my blog post on the matter:

https://www.blimped.nl/managing-and-applying-purview-retention-labels-using-code/

This has also been verified with the PM from Microsoft.

@gautamdsheth
Copy link
Collaborator

hi @danielcecil , will have to close this PR.
Unfortunately, the method has been marked as deprecated, so we shouldn't use it.
Sorry about this, we can't merge it, hope you understand.

@danielcecil
Copy link
Contributor Author

Hi @gautamdsheth thank you for looking into it and your explanation. The docs weren't exactly clear but you and @martinlingstuyl have cleared that up and I agree not to add methods that may become deprecated in future. As I understand it this is the only way to add additional metadata to the application of the Compliance Tag, so it's an example of what I'm doing currently to meet this requirement.

@martinlingstuyl
Copy link
Contributor

In that case you probably should go back to the customer with the message: sorry we can't add extra metadata with when applying a label 😊

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants