I need to set the sub folder group by property through my c# outlook add-in code
basically, i got mails in the folder with different color categories.i need to sort them through my code
Initially i thought of sorting:
Microsoft.Office.Interop.Outlook.Items oItems =m_Outlook.Inbox.Items; oItems.Sort("[Categories]");
开发者_如何学Godosnt work... :( Pretty much lost here
Also trying bubble sorting :
but cant assign mail item to next index
object objMessage = subFolder.Items[counter]; object objNextMessage = subFolder.Items[counter + 1];
subFolder.Items[counter] = objNextMessage; subFolder.Items[counter + 1] = objNextMessage;
Error: Property or indexer 'Microsoft.Office.Interop.Outlook._Items.this[object]' cannot be assigned to -- it is read only
Sorting seemed a difficult option so i thought of grouping . how do i go about it ?
Cheers! Rajat
Sort will re-order the items in the collection but won't update the view:
http://msdn.microsoft.com/en-us/library/microsoft.office.interop.outlook._items.sort.aspx
You'd need to set the collection to be displayed again after sorting.
精彩评论