Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8741833
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T11:23:12+00:00 2026-06-13T11:23:12+00:00

I am using the Exchange Managed API in C# to access data from Exchange

  • 0

I am using the Exchange Managed API in C# to access data from Exchange 2010. I am trying to return the unique identifiers for the email items returned so that they can be retrieved by that id later on in a separate call (i.e. first call returns all mail items and then a second call to retrieve an individual item to mark it as read, etc.). The issue that I am running into is that the string returned as the UniqueId for each mail item is the same. And on top of that, the Id for each Attachment item is also that same string.

I am using this code to retrieve the unread mail from the inbox folder.

var maxItems = 10;
var searchFilter = new SearchFilter.IsEqualTo(EmailMessageSchema.IsRead, false);
var itemView = new ItemView(maxItems);
FindItemsResults<Item> mailItems = service.FindItems(WellKnownFolderName.Inbox, searchFilter, itemView);

When I parse through each item in the mailItems collection, the Id.UniqueId.ToString() of every item is the same.

What am I missing here?

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T11:23:13+00:00Added an answer on June 13, 2026 at 11:23 am

    After digging a bit deeper, it appears that in order to get the unique identifier for a particular mail item, you need both the UniqueId and the ChangeKey properties of the Id. When using Exchange Web Services, both of those are required.

    However, in the Managed API, when you create an ItemId object, it only accepts the UniqueId property and doesn’t provide a setter for the ChangeKey property.

    So, with a bit of reflection, I was able to set that property and then bind to that item.

    var itemId = new ItemId(uniqueId);
    PropertyInfo prop = typeof(ItemId).GetProperty("ChangeKey");
    prop.SetValue(itemId, changeKey, null);
    var emailMessage = EmailMessage.Bind(service, itemId);
    

    The behavior I observed is that the “UniqueId” property could be the same for multiple items. However, the combination of the “UniqueId” and “ChangeKey” never duplicated (even if I duplicated a mail item, the two individual items had different ChangeKey values).

    Why the API would not let you set the ChangeKey on a new ItemId object is beyond me.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to send email using Exchange 2007 from a console app using
Im trying to download share data from a stock exchange using python. The problem
I am using the Exchange Managed API in combination with Exchange 2010 SP1. I
I'm using Exchange Web Services Managed API 1.0 to access the Exchange servers (2007)
I am trying to run a PS1 script using Exchange 2010 remote powershell and
How to access Offline Address Book (from exchange server/outlook configured to exchange machine) using
Is there a way to search Exchange using the EWS Managed API for all
We are using EWS Managed API which polls MS Exchange for new mail messages
using System; using System.Collections.Generic; using System.Text; using System.Net; using System.Net.Mail; using Microsoft.Exchange.WebServices.Data; namespace Email
I have a program that subscribes to multiple Exchange 2010 mailboxes using EWS Managed

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.