At work, we have a custom form to submit PostItems in Public Folder. Because they're in custom form and fields, I can't get them through ExtendedProperties. Every time I try to do that, the ExtendedProperties.Count == 0.
I've seen so many links, but for some reason, they're provided with GUID that doesn't make sense (As in, where did they get that GUID!?), and they're more revolved around Contacts and Calendars, but not PostItems.
The custom fields/columns are stored in an ItemClass called "IPM.Post.Special_Department_INBOX"
Links of examples I've looked at:
- Bind custom extended property for existing appointment using EWS managed API 2.0
Viewing custom extended properties by using the EWS Managed API 2.0
If it helps, this is the code:
public class PublicFolder
{
public string DisplayName { get; set; }
public FolderId FolderID { get; set; }
public int Childs { get; set; }
}
private void DoMagic()
{
try
{
List<PublicFolder> RootFolders = new List<PublicFolder>();
ExchangeService ES = new ExchangeService(ExchangeVersion.Exchange2010_SP2);
try
{
ES.Credentials = new WebCredentials("email@domain.com", "password");
ES.AutodiscoverUrl("email@domain.com");
Folder F = Folder.Bind(ES, WellKnownFolderName.PublicFoldersRoot);
F.Load();
foreach (Folder fol in F.FindFolders(new FolderView(F.ChildFolderCount)))
{
PublicFolder PF = new PublicFolder();
PF.DisplayName = fol.DisplayName;
PF.Childs = fol.ChildFolderCount;
PF.FolderID = fol.Id;
RootFolders.Add(PF);
}
foreach (PublicFolder PF in RootFolders)
{
Folder Q = Folder.Bind(ES, PF.FolderID);
{
if (Q.ChildFolderCount > 0)
{
Q.Load();
if (Q.DisplayName == "Special Department's Folder")
{
foreach (Folder W in Q.FindFolders(new FolderView(Q.ChildFolderCount)))
{
if (W.DisplayName == "Inbox Folder")
{
Folder R = Folder.Bind(ES, W.Id);
{
foreach (Item I in R.FindItems(new ItemView(R.TotalCount)))
{
//THIS IS WHERE I WANT TO GET ITEM'S CUSTOM FIELDS FROM CUSTOM FORM
}
}
}
}
}
}
}
}
}
catch (Exception E)
{
MessageBox.Show(E.Message);
}
}
}