Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
Exchange
2000.active.directory
2000.admin
2000.announcements
2000.app.conversion
2000.applications
2000.clients
2000.clustering
2000.connectivity
2000.development
2000.documentation
2000.general
2000.information.store
2000.interop
2000.kms
2000.misc
2000.protocols
2000.realtime.collabo.
2000.setup
2000.transport
2000.win2000
admin
application.conversion
applications
clients
clustering
connectivity
design
development
misc
mobility
setup
tools
  
 
date: Mon, 28 Jan 2008 12:55:56 -0500,    group: microsoft.public.exchange.development        back       


Exchange 2007 Web Service, get new emails   
I started with the Exchange 2007 code samples from MSDN, for retrieving 
messages from Exchange via web services.
Even though I specify "itemProperties.BaseShape = 
DefaultShapeNamesType.AllProperties;" many of the fields in each message 
(email addresses, body, etc.) are null.
I am trying to use "itemProperties.AdditionalProperties" to include the 
message Body, but it is causing an error.

Where do I go from here?

Thanks,

Eric

ExchangeServiceBinding NewESB = CreateESB();

FindItemType findItemRequest = new FindItemType();

findItemRequest.Traversal = ItemQueryTraversalType.Shallow;

ItemResponseShapeType itemProperties = new ItemResponseShapeType();

//*******Even though I specify AllProperties, not all of the properties are

itemProperties.BaseShape = DefaultShapeNamesType.AllProperties;

itemProperties.BodyType = BodyTypeResponseType.Text;

PathToUnindexedFieldType TheBody = new PathToUnindexedFieldType();

//***********THIS FOLLOWING LINE IS CAUSING THE PROBLEM?

TheBody.FieldURI = UnindexedFieldURIType.itemBody;

//***********ErrorMessage from EWS is "Property is not valid for this 
operation" for the Element "t:FieldURI"

itemProperties.AdditionalProperties = new BasePathToElementType[1];

itemProperties.AdditionalProperties[0] = TheBody;


findItemRequest.ItemShape = itemProperties;

DistinguishedFolderIdType[] TypeArray = new DistinguishedFolderIdType[1];

TypeArray[0] = new DistinguishedFolderIdType();

TypeArray[0].Id = DistinguishedFolderIdNameType.inbox;

findItemRequest.ParentFolderIds = TypeArray;

FindItemResponseType findItemResponse = NewESB.FindItem(findItemRequest);

ArrayOfResponseMessagesType responses = findItemResponse.ResponseMessages;
date: Mon, 28 Jan 2008 12:55:56 -0500   author:   Eric

Re: Exchange 2007 Web Service, get new emails   
Hello,

FindItem will never return all properties.

You'll have to perform a FindItem first and then a GetItem on the details 
you want to retrieve.

Kind regards,
Henning Krause

"Eric"  wrote in message 
news:eswvJcdYIHA.5980@TK2MSFTNGP04.phx.gbl...
>I started with the Exchange 2007 code samples from MSDN, for retrieving 
>messages from Exchange via web services.
> Even though I specify "itemProperties.BaseShape = 
> DefaultShapeNamesType.AllProperties;" many of the fields in each message 
> (email addresses, body, etc.) are null.
> I am trying to use "itemProperties.AdditionalProperties" to include the 
> message Body, but it is causing an error.
>
> Where do I go from here?
>
> Thanks,
>
> Eric
>
> ExchangeServiceBinding NewESB = CreateESB();
>
> FindItemType findItemRequest = new FindItemType();
>
> findItemRequest.Traversal = ItemQueryTraversalType.Shallow;
>
> ItemResponseShapeType itemProperties = new ItemResponseShapeType();
>
> //*******Even though I specify AllProperties, not all of the properties 
> are
>
> itemProperties.BaseShape = DefaultShapeNamesType.AllProperties;
>
> itemProperties.BodyType = BodyTypeResponseType.Text;
>
> PathToUnindexedFieldType TheBody = new PathToUnindexedFieldType();
>
> //***********THIS FOLLOWING LINE IS CAUSING THE PROBLEM?
>
> TheBody.FieldURI = UnindexedFieldURIType.itemBody;
>
> //***********ErrorMessage from EWS is "Property is not valid for this 
> operation" for the Element "t:FieldURI"
>
> itemProperties.AdditionalProperties = new BasePathToElementType[1];
>
> itemProperties.AdditionalProperties[0] = TheBody;
>
>
> findItemRequest.ItemShape = itemProperties;
>
> DistinguishedFolderIdType[] TypeArray = new DistinguishedFolderIdType[1];
>
> TypeArray[0] = new DistinguishedFolderIdType();
>
> TypeArray[0].Id = DistinguishedFolderIdNameType.inbox;
>
> findItemRequest.ParentFolderIds = TypeArray;
>
> FindItemResponseType findItemResponse = NewESB.FindItem(findItemRequest);
>
> ArrayOfResponseMessagesType responses = findItemResponse.ResponseMessages;
>
>
>
>
>
>
date: Mon, 28 Jan 2008 21:20:12 +0100   author:   Henning Krause [MVP - Exchange]

Re: Exchange 2007 Web Service, get new emails   
Thanks!

"Henning Krause [MVP - Exchange]"  
wrote in message news:OfmLzseYIHA.5180@TK2MSFTNGP06.phx.gbl...
> Hello,
>
> FindItem will never return all properties.
>
> You'll have to perform a FindItem first and then a GetItem on the details 
> you want to retrieve.
>
> Kind regards,
> Henning Krause
>
> "Eric"  wrote in message 
> news:eswvJcdYIHA.5980@TK2MSFTNGP04.phx.gbl...
>>I started with the Exchange 2007 code samples from MSDN, for retrieving 
>>messages from Exchange via web services.
>> Even though I specify "itemProperties.BaseShape = 
>> DefaultShapeNamesType.AllProperties;" many of the fields in each message 
>> (email addresses, body, etc.) are null.
>> I am trying to use "itemProperties.AdditionalProperties" to include the 
>> message Body, but it is causing an error.
>>
>> Where do I go from here?
>>
>> Thanks,
>>
>> Eric
>>
>> ExchangeServiceBinding NewESB = CreateESB();
>>
>> FindItemType findItemRequest = new FindItemType();
>>
>> findItemRequest.Traversal = ItemQueryTraversalType.Shallow;
>>
>> ItemResponseShapeType itemProperties = new ItemResponseShapeType();
>>
>> //*******Even though I specify AllProperties, not all of the properties 
>> are
>>
>> itemProperties.BaseShape = DefaultShapeNamesType.AllProperties;
>>
>> itemProperties.BodyType = BodyTypeResponseType.Text;
>>
>> PathToUnindexedFieldType TheBody = new PathToUnindexedFieldType();
>>
>> //***********THIS FOLLOWING LINE IS CAUSING THE PROBLEM?
>>
>> TheBody.FieldURI = UnindexedFieldURIType.itemBody;
>>
>> //***********ErrorMessage from EWS is "Property is not valid for this 
>> operation" for the Element "t:FieldURI"
>>
>> itemProperties.AdditionalProperties = new BasePathToElementType[1];
>>
>> itemProperties.AdditionalProperties[0] = TheBody;
>>
>>
>> findItemRequest.ItemShape = itemProperties;
>>
>> DistinguishedFolderIdType[] TypeArray = new DistinguishedFolderIdType[1];
>>
>> TypeArray[0] = new DistinguishedFolderIdType();
>>
>> TypeArray[0].Id = DistinguishedFolderIdNameType.inbox;
>>
>> findItemRequest.ParentFolderIds = TypeArray;
>>
>> FindItemResponseType findItemResponse = NewESB.FindItem(findItemRequest);
>>
>> ArrayOfResponseMessagesType responses = 
>> findItemResponse.ResponseMessages;
>>
>>
>>
>>
>>
>>
>
date: Fri, 1 Feb 2008 10:52:04 -0500   author:   Eric

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us