// Token: 0x06001C02 RID: 7170 RVA: 0x0006D978 File Offset: 0x0006BB78
        private static void CreateFailureMessages(UserContext userContext, ExchangePrincipal exchangePrincipal, Dictionary <string, IList <IUserSharingResult> > failedResultsDictionary, List <string> noProviderResources, List <string> resourceList, List <string> largeDLsList)
        {
            string text = null;
            List <AttachmentFile> list;

            if (noProviderResources != null)
            {
                list = UpdateAttachmentPermissions.GetAttachmentFiles(noProviderResources);
                text = AttachmentMessageBodyGenerator.GenerateBodyForAttachmentNotFound(list);
                UpdateAttachmentPermissions.CreateOneFailureMessage(userContext, exchangePrincipal, text, list);
            }
            if (failedResultsDictionary != null && failedResultsDictionary.Count > 0)
            {
                list = new List <AttachmentFile>();
                List <string>     list2 = new List <string>();
                IRecipientSession adrecipientSession = CallContext.Current.ADRecipientSessionContext.GetADRecipientSession();
                foreach (string text2 in failedResultsDictionary.Keys)
                {
                    AttachmentFile item = new AttachmentFile(UpdateAttachmentPermissions.GetFileNameFromLocation(text2), HttpUtility.UrlDecode(text2));
                    list.Add(item);
                    foreach (IUserSharingResult userSharingResult in failedResultsDictionary[text2])
                    {
                        string text3 = userSharingResult.User;
                        if (text3 != null && !text3.Contains("@"))
                        {
                            text3 = UpdateAttachmentPermissions.ConvertBetweenADRecipientProperties(adrecipientSession, text3, ADRecipientSchema.ExternalDirectoryObjectId, ADRecipientSchema.PrimarySmtpAddress);
                        }
                        if (text3 != null)
                        {
                            list2.Add(text3);
                        }
                    }
                }
                text = AttachmentMessageBodyGenerator.GenerateBodyForSetWrongPermission(list, list2);
                UpdateAttachmentPermissions.CreateOneFailureMessage(userContext, exchangePrincipal, text, list);
            }
            list = UpdateAttachmentPermissions.GetAttachmentFiles(resourceList);
            if (largeDLsList != null && largeDLsList.Count > 0)
            {
                StringBuilder stringBuilder = new StringBuilder();
                foreach (string value in largeDLsList)
                {
                    if (stringBuilder.Length > 0)
                    {
                        stringBuilder.Append(Strings.DistributionListNameSeperator);
                    }
                    stringBuilder.Append(value);
                }
                text = AttachmentMessageBodyGenerator.GenerateBodyForSentToTooLargeDL(list, stringBuilder.ToString());
                UpdateAttachmentPermissions.CreateOneFailureMessage(userContext, exchangePrincipal, text, list);
                return;
            }
            if (text == null)
            {
                text = AttachmentMessageBodyGenerator.GenerateBodyForCatchAll(list);
                UpdateAttachmentPermissions.CreateOneFailureMessage(userContext, exchangePrincipal, text, list);
            }
        }
 // 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: 0x06001C03 RID: 7171 RVA: 0x0006DB60 File Offset: 0x0006BD60
        private static List <AttachmentFile> GetAttachmentFiles(List <string> resourceList)
        {
            List <AttachmentFile> list = new List <AttachmentFile>();

            if (resourceList != null)
            {
                foreach (string text in resourceList)
                {
                    AttachmentFile item = new AttachmentFile(UpdateAttachmentPermissions.GetFileNameFromLocation(text), HttpUtility.UrlDecode(text));
                    list.Add(item);
                }
            }
            return(list);
        }