Error while using IpcCreateLicenseFromTemplateId function in RMSSDK2.1 in AzureInformationProtection

%3CLINGO-SUB%20id%3D%22lingo-sub-830712%22%20slang%3D%22en-US%22%3EError%20while%20using%20IpcCreateLicenseFromTemplateId%20function%20in%20RMSSDK2.1%20in%20AzureInformationProtection%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-830712%22%20slang%3D%22en-US%22%3E%3CP%3EHi%2C%3C%2FP%3E%3CP%3EI%20am%20using%20RMS%20client%202.1%20SDK%20to%20apply%20protection%20on%20PDF%20file.%3C%2FP%3E%3CP%3EClient%20has%20provided%20us%20with%20template%20ID.%3C%2FP%3E%3CP%3EBut%20when%20I%20try%20to%20use%20the%20function%3CSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%22IpcCreateLicenseFromTemplateId%22%26nbsp%3B%3C%2FSTRONG%3EI%20get%20error%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSTRONG%3E%E2%80%9CThe%20System%20cannot%20find%20the%20file%20specified.%20HRESULT%3A%200x80070002%E2%80%9D.%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3E%3CSTRONG%3E****************************************************************************************%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3Estring%20viewAndPrint%20%3D%20%22xxxxx-xxxx-xxx-xxxx-xxxxxxxx%22%3B%3C%2FP%3E%3CP%3E%3CSTRONG%3E%3CU%3E%2F%2FError%20in%20thisline%3C%2FU%3E%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3E%3CSTRONG%3E%3CU%3ESafeInformationProtectionLicenseHandle%20handle%20%3D%20SafeNativeMethods.IpcCreateLicenseFromTemplateId(viewAndPrint)%3B%3C%2FU%3E%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ESafeNativeMethods.IpcSetLicenseUserRightsList(handle%2C%20userRights)%3B%3C%2FP%3E%3CP%3ESafeNativeMethods.IpcSetLicenseValidityTime(handle%2C%20term)%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3Estring%20encryptedFilePath%20%3D%20SafeFileApiNativeMethods.IpcfEncryptFile(%3CBR%20%2F%3EfilePath%2C%3CBR%20%2F%3Ehandle%2C%3CBR%20%2F%3ESafeFileApiNativeMethods.EncryptFlags.IPCF_EF_FLAG_KEY_NO_PERSIST%2C%3CBR%20%2F%3Etrue%2Cfalse%2Ctrue%2Cnull%2CsymmetricKeyCred)%3B%3C%2FP%3E%3CP%3E****************************************************************************************%3C%2FP%3E%3CP%3EPlease%20help%20me%20solve%20this%20error.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-830712%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EAzure%20Information%20Protection%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3ERights%20Management%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3ESDK%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
Occasional Contributor

Hi,

I am using RMS client 2.1 SDK to apply protection on PDF file.

Client has provided us with template ID.

But when I try to use the function "IpcCreateLicenseFromTemplateId" I get error 

“The System cannot find the file specified. HRESULT: 0x80070002”.

****************************************************************************************

string viewAndPrint = "xxxxx-xxxx-xxx-xxxx-xxxxxxxx";

//Error in thisline

SafeInformationProtectionLicenseHandle handle = SafeNativeMethods.IpcCreateLicenseFromTemplateId(viewAndPrint);

 

SafeNativeMethods.IpcSetLicenseUserRightsList(handle, userRights);

SafeNativeMethods.IpcSetLicenseValidityTime(handle, term);

 

string encryptedFilePath = SafeFileApiNativeMethods.IpcfEncryptFile(
filePath,
handle,
SafeFileApiNativeMethods.EncryptFlags.IPCF_EF_FLAG_KEY_NO_PERSIST,
true,false,true,null,symmetricKeyCred);

****************************************************************************************

Please help me solve this error.

0 Replies