public TaskSendLink(ObservableCollection<IProtectAttachment> attachments, ITaskSendLinkOptions options, IDoxSession session) { _attachments = attachments; _options = options; _session = session; }
public static List<IWorkshareTask> Create(ObservableCollection<IProtectAttachment> attachments, Dictionary<string, dynamic> options, IDoxSession session) { ClearLastError(attachments); List<IWorkshareTask> tasks = CreateSubTasks(attachments, options); if (IsRepacking(attachments, tasks)) { tasks.Add(new TaskRepack(attachments)); } if (IsConvertingToZip(options)) { tasks.Add(CreateZipTask(attachments, options)); } if (IsSendingFilesSecurely(options) && session != null) { tasks.Add(CreateSendFilesSecurelyTask(attachments, options, session)); } return tasks; }
public static void Add(MailItem mailItem, long folderId, IDoxSession session) { mailItem.Recipients.ResolveAll(); var emailAddresses = new List<string>(); foreach (Recipient recipient in mailItem.Recipients) { if (recipient.AddressEntry != null) { if (recipient.AddressEntry.AddressEntryUserType == OlAddressEntryUserType.olExchangeDistributionListAddressEntry) { try { var distributionList = recipient.AddressEntry.GetExchangeDistributionList(); var members = distributionList.GetExchangeDistributionListMembers(); if (members != null) { emailAddresses.AddRange(GetEmailAddresses(members)); } } catch (Exception e) { Logger.LogError(e); } } else { emailAddresses.Add(GetEmailAddress(recipient.AddressEntry)); } } } foreach (var emailAddress in emailAddresses) { var myEmailAddress = GetMyEmailAddress(); if (string.Compare(myEmailAddress, emailAddress, true) != 0) { session.ApiHelper.AddMemberToFolder(emailAddress, folderId); } } }
private static bool ValidateSession(string serviceUrl, IDoxSession session, string username) { if (session != null && session.CurrentUser != null) { if (IsProfessionalEnabled(serviceUrl, username)) { if ((String.Compare(session.CurrentUser.AccountType, "business", StringComparison.InvariantCultureIgnoreCase) == 0) || (String.Compare(session.CurrentUser.AccountType, "enterprise", StringComparison.InvariantCultureIgnoreCase) == 0)) { OptionApi.SetString("SendLinkCloudStorageLoginName", username); OptionApi.SetEncrypted("SendLinkDeviceToken", session.Credentials.DeviceToken, _entropy); OptionApi.SetEncrypted("SendLinkAccountId", session.CurrentUser.AccountId, _entropy); OptionApi.SetEncrypted("SendLinkPlan", session.CurrentUser.AccountType, _entropy); return true; } } OptionApi.SetEncrypted("SendLinkDeviceToken", "", _entropy); OptionApi.SetEncrypted("SendLinkPlan", "", _entropy); } return false; }
private static IWorkshareTask CreateSendFilesSecurelyTask(ObservableCollection<IProtectAttachment> attachments, Dictionary<string, dynamic> options, IDoxSession session) { var sendOptions = new TaskSendLinkOptions(); if (options.ContainsKey(PropertyNames.SendFilesSecurelyMustLogin)) sendOptions.RecipientsMustLogin = options[PropertyNames.SendFilesSecurelyMustLogin]; if (options.ContainsKey(PropertyNames.SendFilesSecurelyCanDownload)) sendOptions.RecipientsCanDownload = options[PropertyNames.SendFilesSecurelyCanDownload]; if (options.ContainsKey(PropertyNames.SendFilesSecurelyCanInvite)) sendOptions.RecipientsCanInvite = options[PropertyNames.SendFilesSecurelyCanInvite]; if (options.ContainsKey(PropertyNames.SendFilesSecurelyGetReturnReceipt)) sendOptions.GetReturnReceipt = options[PropertyNames.SendFilesSecurelyGetReturnReceipt]; if (options.ContainsKey(PropertyNames.SendFilesSecurelyExpiryDate) && !string.IsNullOrEmpty(options[PropertyNames.SendFilesSecurelyExpiryDate])) sendOptions.ExpiryDate = Convert.ToDateTime(options[PropertyNames.SendFilesSecurelyExpiryDate]); return new TaskSendLink(attachments, sendOptions, session); }
private bool LogInUser(string dialogUsername, string dialogPassword, ref string error, out IDoxSession session) { session = Api.CreateSessionFromPassword(dialogUsername, dialogPassword, ApiHelper); if (session != null) { return true; } if (Api.Error == null || Api.Error.HttpStatus != 422 || !Api.Error.ErrorCodes.Contains("user_has_no_password")) { error = Properties.Resources.IncorrectLoginDetails; return false; } string newPassword; if (!SetPasswordDialog(dialogUsername, out newPassword)) { return false; } session = Api.CreateSessionFromPassword(dialogUsername, newPassword, ApiHelper); if (session != null) { return true; } error = "Unable to log in, please try again"; return false; }