{"record":{"id":"fa64d8c5f26ecf66","repo":"dotnet/wpf","slug":"sr-rmproviderexceptionnorightstodocument","errorCode":null,"errorMessage":"SR.RMProviderExceptionNoRightsToDocument","messagePattern":"SR\\.RMProviderExceptionNoRightsToDocument","errorType":"exception","errorClass":"XpsViewerException","httpStatus":null,"severity":"error","filePath":"src/Microsoft.DotNet.Wpf/src/PresentationUI/MS/Internal/Documents/RightsManagementManager.cs","lineNumber":223,"sourceCode":"                    RightsManagementOperation.Decrypt,\n                    exception);\n\n                // On an exception here we can't continue; rethrow it in an\n                // XPSViewer exception\n                throw new XpsViewerException(\n                    SR.XpsViewerRightsManagementException,\n                    exception);\n            }\n\n            if (_rmProvider.IsProtected)\n            {\n                // Get a use license for the new package\n                RightsManagementLicense license = GetUseLicense();\n\n                if (license == null ||\n                    !license.HasPermission(RightsManagementPermissions.AllowView))\n                {\n                    throw new XpsViewerException(\n                        SR.RMProviderExceptionNoRightsToDocument);\n                }\n            }\n\n            if (publishLicenseChanged)\n            {\n                // Fire the event to indicate a new publish license\n                OnPublishLicenseChange();\n            }\n\n            // Evaluate the status of the new package (to fire events)\n            Evaluate();\n        }\n\n        /// <summary>\n        /// Displays the Credential Management UI.\n        /// </summary>\n        internal void ShowCredentialManagementUI()","sourceCodeStart":205,"sourceCodeEnd":241,"githubUrl":"https://github.com/dotnet/wpf/blob/81131a70a4c573cd62748a5c36908fc4d662daa9/src/Microsoft.DotNet.Wpf/src/PresentationUI/MS/Internal/Documents/RightsManagementManager.cs#L205-L241","documentation":"Thrown by RightsManagementManager.SetEncryptedPackage when a newly loaded rights-managed XPS package cannot be opened for viewing. GetUseLicense() returned no usable license or the license lacks the AllowView permission, meaning the current user is not granted view rights by the document's publish license. The viewer refuses to decrypt/display a document the user has no rights to.","triggerScenarios":"Calling SetEncryptedPackage with an encrypted package whose use license is missing, expired, or does not grant AllowView to the current user (e.g. RM environment/user account differs from the one the document was published to).","commonSituations":"Opening an RM-protected XPS on a machine without Active Directory Rights Management Services access; user account not in the grant list; expired or revoked license; wrong RM cluster/URL configuration.","solutions":["Verify the current user is listed as a grantee with View rights in the document's publish license","Confirm the Active Directory RM environment/cluster URL is reachable and the user is activated for it","Re-acquire the use license (check license expiry/revocation) or re-publish the document granting the user rights","Decrypt the document for the intended user before opening it in the viewer"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// check rights before opening\nif (!rmManager.IsProtected || userHasViewRights(useLicense)) { open(); }","typeGuard":"bool IsViewable(RightsManagementLicense l) => l != null && l.HasPermission(RightsManagementPermissions.AllowView);","tryCatchPattern":"try { rmManager.SetEncryptedPackage(pkg); }\ncatch (XpsViewerException ex) { /* show 'no rights to view document' UI */ }","preventionTips":["Confirm the user has View rights before opening protected documents","Keep the RM environment (AD RMS cluster) reachable and the account activated","Watch for expired/revoked licenses and re-acquire them"],"tags":["rights-management","xps","permissions"],"backgroundTag":"permission-denied","analyzedSha":"81131a70a4c573cd62748a5c36908fc4d662daa9","analyzedAt":"2026-09-14T10:12:48.479Z","contentChangedAt":"2026-09-14T10:12:48.479Z","schemaVersion":2},"datasetVersion":"2026-09-22T01:17:13.364Z"}