// Token: 0x06001BFF RID: 7167 RVA: 0x0006D71C File Offset: 0x0006B91C private static void SendInvitationMessage(UserContext userContext, ExchangePrincipal exchangePrincipal, string user, string location, string invitationLink) { try { OwaDiagnostics.SendWatsonReportsForGrayExceptions(delegate() { if (string.IsNullOrEmpty(user)) { throw new ArgumentNullException("user", "User name cannot be null when sending invite!"); } if (string.IsNullOrEmpty(invitationLink)) { throw new ArgumentNullException("invitationLink", "InvitationLink cannot be null when sending invite!"); } if (string.IsNullOrEmpty(location)) { throw new ArgumentNullException("location", "Document location cannot be null when sending invite!"); } try { string fileNameFromLocation = UpdateAttachmentPermissions.GetFileNameFromLocation(location); userContext.LockAndReconnectMailboxSession(); MessageItem messageItem = MessageItem.Create(userContext.MailboxSession, userContext.MailboxSession.GetDefaultFolderId(DefaultFolderType.Inbox)); messageItem.From = new Participant(exchangePrincipal); messageItem.Sender = messageItem.From; messageItem.Subject = string.Format(Strings.GuestSharingInvitationSubject, exchangePrincipal.MailboxInfo.DisplayName, fileNameFromLocation); messageItem.IsDraft = false; messageItem.IsRead = false; messageItem.Recipients.Add(new Participant(user, user, "SMTP")); string bodyContent = AttachmentMessageBodyGenerator.GenerateBodyForInvitation(fileNameFromLocation, invitationLink); UpdateAttachmentPermissions.SetItemBody(messageItem, BodyFormat.TextHtml, bodyContent); messageItem.SendWithoutSavingMessage(); } catch (InvalidRecipientsException ex2) { ExTraceGlobals.AttachmentHandlingTracer.TraceError <string>(0L, "[UpdateAttachmentPermissions : SendInvitationMessage] Exception happened when trying to send the invitation message : {0}", ex2.StackTrace); } finally { if (userContext.MailboxSessionLockedByCurrentThread()) { userContext.UnlockAndDisconnectMailboxSession(); } } }); } catch (GrayException ex) { ExTraceGlobals.AttachmentHandlingTracer.TraceError <string>(0L, "[UpdateAttachmentPermissions : SendInvitationMessage] Exception happened when trying to send the invitation message : {0}", ex.StackTrace); } }
// Token: 0x06001C00 RID: 7168 RVA: 0x0006D8C0 File Offset: 0x0006BAC0 private static void CreateOneFailureMessage(UserContext userContext, ExchangePrincipal exchangePrincipal, string body, List <AttachmentFile> attachmentFiles) { try { OwaDiagnostics.SendWatsonReportsForGrayExceptions(delegate() { try { userContext.LockAndReconnectMailboxSession(); MessageItem messageItem = MessageItem.Create(userContext.MailboxSession, userContext.MailboxSession.GetDefaultFolderId(DefaultFolderType.Inbox)); messageItem.From = new Participant("Microsoft Outlook", "*****@*****.**", "SMTP"); messageItem.Sender = messageItem.From; messageItem.IsDraft = false; messageItem.IsRead = false; messageItem.Recipients.Add(new Participant(exchangePrincipal), RecipientItemType.To); UpdateAttachmentPermissions.SetItemBody(messageItem, BodyFormat.TextHtml, body); if (attachmentFiles.Count == 1) { messageItem.Subject = string.Format(Strings.OneAttachmentSharingFailureSubject, attachmentFiles[0].FileName); } else { messageItem.Subject = Strings.AttachmentSharingFailureSubject; } messageItem.Save(SaveMode.NoConflictResolutionForceSave); messageItem[ItemSchema.ReceivedTime] = ExDateTime.Now; messageItem.Save(SaveMode.ResolveConflicts); } finally { if (userContext.MailboxSessionLockedByCurrentThread()) { userContext.UnlockAndDisconnectMailboxSession(); } } }); } catch (GrayException ex) { ExTraceGlobals.AttachmentHandlingTracer.TraceError <string>(0L, "[UpdateAttachmentPermissions : CreateMessage] Exception happened when trying to send message : {0}", ex.StackTrace); } }