SharePoint On Premises- Error downloading files from IRM enabled library

This post has been republished via RSS; it originally appeared at: SharePoint Support Blog articles.

Issue in detail:

--------------------

Users started complaining that the files are not getting downloaded from any document libraries that are protected with Information Rights Management Service. They know that it worked before but suddenly stopped working. While downloading the documents they are getting the error:

 

"The document you tried to download could not be protected. You may need to contact the library administrator to help resolving. Error code is: 80020009."

 

SharePoint Administrators looked into the issue and found following errors in the ULS logs related to IRM:

 

SharePoint Foundation Information Rights Management 5806 Critical Information Rights Management (IRM): The email of the requesting user is empty. 


SharePoint Foundation Information Rights Management 5065 Critical Information Rights Management (IRM): There was a problem while trying to customize a base issuance license for a protected file. Current file: XXXXX GUID of current list: {XXXXXXXXXXXX} An issuance licenses stored in an IRM protected file is customized from a generic issuance license template. Additional Data Error value: 0x80070057 


SharePoint Foundation Information Rights Management 5820 Critical Information Rights Management (IRM): There was a problem while initializing IRM document. Status value: -1, error value: 0x80070057. 


SharePoint Foundation Information Rights Management 5819 Critical Information Rights Management (IRM): There was a problem while ensure IRM client. Status value: -1, error value: 0x80020009. 

 

All the errors pointed to IRM and upon checking it was confirmed that the IRM is configured correctly and the Service accounts are given the right privileges to use the service.

 

On further digging the ULS logs following error was discovered:

 

Getting Error Message for Exception System.Web.HttpUnhandledException (0x80004005): Exception of type 'System.Web.HttpUnhandledException' was thrown. ---> Microsoft.SharePoint.SPException: The document you tried to download could not be protected. You may need to contact the library administrator to help resolving. Error code is: 80020009. ---> System.Runtime.InteropServices.COMException: The document you tried to download could not be protected. You may need to contact the library administrator to help resolving. Error code is: 80020009.
at Microsoft.SharePoint.Library.SPRequestInternalClass.GetFileAsStream(String bstrUrl, String bstrWebRelativeUrl, Boolean bHonorLevel, Byte iLevel, OpenBinaryFlags grfob, String bstrEtagNotMatch, Object punkSPFileMgr, Boolean bHonorCustomIrm, IrmProtectionParams fileIrmSettings, UInt32& pdwVirusCheckStatus, String& pVirusCheckMessage, String& pEtagNew, String& pContentTagNew, SPFileInfo& pFileProps)
at Microsoft.SharePoint.Library.SPRequest.GetFileAsStream(String bstrUrl, String bstrWebRelativeUrl, Boolean bHonorLevel, Byte iLevel, OpenBinaryFlags grfob, String bstrEtagNotMatch, Object punkSPFileMgr, Boolean bHonorCustomIrm, IrmProtectionParams fileIrmSettings, UInt32& pdwVirusCheckStatus, String& pVirusCheckMessage, String& pEtagNew, String& pContentTagNew, SPFileInfo& pFileProps) -
-- End of inner exception stack trace ---
at Microsoft.SharePoint.SPGlobal.HandleComException(COMException comEx)
at Microsoft.SharePoint.Library.SPRequest.GetFileAsStream(String bstrUrl, String bstrWebRelativeUrl, Boolean bHonorLevel, Byte iLevel, OpenBinaryFlags grfob, String bstrEtagNotMatch, Object punkSPFileMgr, Boolean bHonorCustomIrm, IrmProtectionParams fileIrmSettings, UInt32& pdwVirusCheckStatus, String& pVirusCheckMessage, String& pEtagNew, String& pContentTagNew, SPFileInfo& pFileProps)
at Microsoft.SharePoint.SPFile.GetFileStream(SPWeb web, String fileUrl, Boolean honorLevel, SPFileLevel level, OpenBinaryFlags openOptions, String etagNotMatch, SPFileStreamManager spMgr, SPFileRightsManagementSettings rightsManagementSettings, Boolean throwOnVirusFound, SPVirusCheckStatus& virusCheckStatus, String& virusCheckMessage, String& etagNew, String& contentTagNew, SPFileInfo& fileprops)
at Microsoft.SharePoint.SPFile.GetFileStream(OpenBinaryFlags openOptions, String etagNotMatch, String& etagNew, String& contentTagNew)
at Microsoft.SharePoint.ApplicationPages.Download.WriteFileInternal(String sourceUrl, SPFile file)
at Microsoft.SharePoint.ApplicationPages.Download.OnLoad(EventArgs e)
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.HandleError(Exception e)
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.ProcessRequest()
at System.Web.UI.Page.ProcessRequest(HttpContext context)
at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step)
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

 

From the above stack it was clear that its throwing exception at:

 

Microsoft.SharePoint.Library.SPRequestInternalClass.GetFileAsStream(String bstrUrl, String bstrWebRelativeUrl, Boolean bHonorLevel, Byte iLevel, OpenBinaryFlags grfob, String bstrEtagNotMatch, Object punkSPFileMgr, Boolean bHonorCustomIrm, IrmProtectionParams fileIrmSettings, UInt32& pdwVirusCheckStatus, String& pVirusCheckMessage, String& pEtagNew, String& pContentTagNew, SPFileInfo& pFileProps) 

 

Resolution:

---------------

 

From the stack it was understood that the error is thrown after Antivirus Check. Fix is to add all the AV exclusions mentioned in the article here.

 

Note: This is applicable to all SharePoint On Premises Versions.

 

Leave a Reply

Your email address will not be published. Required fields are marked *

*

This site uses Akismet to reduce spam. Learn how your comment data is processed.