private FindItemsResults <Item> GetEmailItems() { logger.DebugFormat( "Fetching up to [{0}] email(s) from [{1}]...", numMessagesPerTick, folderId.ToString()); var findResults = exchangeService.FindItems( folderId, new ItemView(numMessagesPerTick)); logger.DebugFormat("FindItems retrieved [{0}] entries...", findResults.Count()); return(findResults); }
/// <summary> /// Formats the dataa into appropriate xml for sending in a persist request to Campaign. /// </summary> /// <param name="ownerDocument">Document to create the xml element from</param> /// <returns>Xml element containing all the properties to update</returns> public virtual XmlElement GetXmlForPersist(XmlDocument ownerDocument) { var element = GetBaseXmlForPersist(ownerDocument, "@internalName"); element.AppendAttribute("internalName", Name.Name); if (Label != null) { element.AppendAttribute("label", Label); } if (FolderId != null) { var folderElement = element.AppendChild("folder"); folderElement.AppendAttribute("id", FolderId.ToString()); } var contentDoc = new XmlDocument(); contentDoc.LoadXml(RawXml); foreach (var attribute in contentDoc.DocumentElement.Attributes.Cast <XmlAttribute>().ToArray()) { element.AppendAttribute(attribute.Name, attribute.Value); } foreach (var child in contentDoc.DocumentElement.ChildNodes.Cast <XmlNode>().ToArray()) { var importedNode = ownerDocument.ImportNode(child, true); element.AppendChild(importedNode); } return(element); }
public string ToQuery() { var b = new QueryBuilder(); b.AddQuery(Routes.Query.FolderId, FolderId.ToString()); b.AddQuery(Routes.Query.Mode, Mode.ToString()); return(b.Result); }
public YouMailMessageQuery(QueryType type) : base(type) { FolderId = -1; IncludeFullName = true; IncludeExtraInfo = true; IncludeImageUrl = false; IncludePreview = false; IncludeContactInfo = false; IncludeLocation = false; DataFormat = DataFormat.MP3; switch (type) { case QueryType.GetMessages: AddQueryItem(YMST.c_folderId, FolderId.ToString()); AddQueryItem(YMST.c_dataFormat, ((int)DataFormat).ToString()); AddDefaultMessageParams(); break; case QueryType.GetMessage: AddQueryItem(YMST.c_dataFormat, ((int)DataFormat).ToString()); AddDefaultMessageParams(); break; case QueryType.GetMessagesSince: // Add the updated from field AddQueryItem(YMST.c_dataFormat, ((int)DataFormat).ToString()); AddQueryItem(YMST.c_folderId, FolderId.ToString()); AddQueryItem(YMST.c_deleteType, ((int)YouMailMessageVisibility.NoRestriction).ToString()); AddDefaultMessageParams(); break; case QueryType.GetMessagesCreatedSince: // Use the updated from field for the CreatedFrom AddQueryItem(YMST.c_dataFormat, ((int)DataFormat).ToString()); AddQueryItem(YMST.c_folderId, FolderId.ToString()); AddQueryItem(YMST.c_deleteType, ((int)YouMailMessageVisibility.NoRestriction).ToString()); break; case QueryType.GetMessageHistory: case QueryType.GetHistory: AddDefaultHistoryParams(); break; } }
/// <summary> /// Formats the dataa into appropriate xml for sending in a persist request to Campaign. /// </summary> /// <param name="ownerDocument">Document to create the xml element from</param> /// <returns>Xml element containing all the properties to update</returns> public virtual XmlElement GetXmlForPersist(XmlDocument ownerDocument) { var element = GetBaseXmlForPersist(ownerDocument, "@name"); element.AppendAttribute("name", Name.Name); if (Label != null) { element.AppendAttribute("label", Label); } if (FolderId != null) { var folderElement = element.AppendChild("folder"); folderElement.AppendAttribute("id", FolderId.ToString()); } var sourceElement = element.AppendChild("source"); if (VariesByFormat != null) { sourceElement.AppendAttribute("dependOnFormat", VariesByFormat.Value.ToString().ToLower()); } if (TextCode != null) { var textElement = sourceElement.AppendChild("text"); var textCData = ownerDocument.CreateCDataSection(TextCode); textElement.AppendChild(textCData); } if (HtmlCode != null) { var htmlElement = sourceElement.AppendChild("html"); var htmlCData = ownerDocument.CreateCDataSection(HtmlCode); htmlElement.AppendChild(htmlCData); } if (IncludeInCustomisationMenus != null) { element.AppendAttribute("visible", IncludeInCustomisationMenus.Value.ToString().ToLower()); } return(element); }
public void TestFolderIdProperties() { FolderId folderId = new FolderId( "abcdefgh", "*****@*****.**"); Assert.AreEqual( folderId.Id, "abcdefgh"); Assert.AreEqual( folderId.MessagesContainer, "mailfolders/abcdefgh/messages"); Assert.AreEqual( folderId.RootContainer, "mailfolders"); Assert.AreEqual( folderId.MessagesDelta, "mailfolders/abcdefgh/messages/delta"); Assert.AreEqual( folderId.ChildFoldersContainer, "mailfolders/abcdefgh/childfolders"); Assert.AreEqual( folderId.ToString(), "abcdefgh"); Assert.AreEqual( folderId.MailboxId, new MailboxId("*****@*****.**")); folderId = new FolderId("abcdeef"); Assert.AreEqual( folderId.MailboxId, new MailboxId("me")); folderId = new FolderId(WellKnownFolderName.ArchiveInbox); Assert.AreEqual( folderId.MailboxId, new MailboxId("me")); }
private string GetMenuIconBitmapPath() { var cachePath = Path.Combine(Path.GetTempPath(), FolderId.ToString("N") + ".png"); if (!IOUtilities.FileExists(cachePath)) { using (var stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(GetType().Namespace + ".UI.CloudFolder.ico")) { if (stream == null) { throw new InvalidOperationException(); } // note the 16 size is a 256 colors, not a full RGB color as the Shell's context menu doesn't like that var bmps = IconUtilities.LoadIconsFromStream(stream); var bmp = bmps.FirstOrDefault(i => i.Height == 16); bmp.Save(cachePath); } } return(cachePath); }
static void Main(string[] args) { // Attempt to retrieve the unique identifier of the folder with display name "Custom Folder" (located in the Inbox folder). FolderId folderId = FindFolderIdByDisplayName(service, "Custom Folder", WellKnownFolderName.Inbox); if (folderId != null) { Console.WriteLine("The unique identifier of the 'Custom Folder' folder (in the Inbox folder) is: " + folderId.ToString()); } else { Console.WriteLine("The 'Custom Folder' folder was not found in the Inbox folder."); } Console.WriteLine("\r\n"); Console.WriteLine("Press or select Enter..."); Console.Read(); }