/// <summary> /// Initializes properties. /// </summary> private void InitializeAttachment() { AttachmentInfo attachmentInfo; if (InfoObject != null) { attachmentInfo = InfoObject as AttachmentInfo; } else { // If using workflow then get versioned attachment if (VersionHistoryID != 0) { // Get the versioned attachment with binary data var attachmentHistory = VersionManager.GetAttachmentVersion(VersionHistoryID, ObjectGuid, false); // Create new attachment object attachmentInfo = (attachmentHistory != null) ? AttachmentInfo.New(attachmentHistory) : null; if (attachmentInfo != null) { // Save attachment history identifier for unique test AttachmentHistoryID = attachmentHistory.AttachmentHistoryID; attachmentInfo.AttachmentVersionHistoryID = VersionHistoryID; } } // Else get file without binary data else { attachmentInfo = AttachmentInfoProvider.GetAttachmentInfoWithoutBinary(ObjectGuid, SiteName); } InfoObject = attachmentInfo; } if (attachmentInfo != null) { // Check permissions if (CheckPermissions) { // If attachment is temporary, check 'Create' permission on parent node. Else check 'Modify' permission. NodePermissionsEnum permission = nodeIsParent ? NodePermissionsEnum.Create : NodePermissionsEnum.Modify; if (Node == null) { RedirectToInformation(GetString("editeddocument.notexists")); } if (MembershipContext.AuthenticatedUser.IsAuthorizedPerDocument(Node, permission) != AuthorizationResultEnum.Allowed) { RedirectToAccessDenied(GetString("metadata.errors.filemodify")); } } // Fire event GetObjectExtension if (GetObjectExtension != null) { GetObjectExtension(attachmentInfo.AttachmentExtension); } } else { RedirectToInformation(GetString("editedobject.notexists")); } }