Jun 12 2020 02:39 AM
Jun 12 2020 02:39 AM
A while ago I have written a service (in C#) to connect to Azure Information Protection (with the SDK 1.2.153) to unprotect files, change them and reprotect them again with the same protection they had before.
I've got the protection lizense/information by calling FileHandler.GetserializedPublishingLizense and GetSerializedProtectionInfo, then I've called RemoveProtection and in the end i've reset the protection by calling SetProtection with the results that I've got earlier.
Now I try to do the same with the SDK version 1.6.113 without success.
Every funcion changed. Now I cannot even create a FileEngine without an identity or a cloud.
If I set an identity (the mail address is not important), I can create a FileEngine. If I choose Commercial cloud I can also create the FileEngine.
Then I get the protection description by getting the handler.Protection.ProtectionDescriptor-property.
I am able to unprotect the file and to change it. But when I try to reprotect it (using the protection descriptor) the protection is messed up. The file gets protected but I cannot access it.
If I try to set the same label (which I got before unprotecting the file) the same happens. The file is protected but I cannot access ist.
What am I doing wrong?
Any help would be appreciated!
Jun 18 2020 04:44 PMSolution
Hi! This scenario functions a bit differently than you might expect. We refer to this as republishing and we've recently documented it here: https://docs.microsoft.com/en-us/information-protection/develop/quick-file-republishing-csharp
Can you take a look at that and let me know if it answers your question?
The cloud or identity are required for service discovery. When you create the FileEngineSettings object, you must provide an object of Microsoft.InformationProtection.Identity as part of the constructor, or set it on the object after initialization.
If you don't have the identity of the user, then you must set the Cloud parameter on the FileEngineSettings object.