Skip to content

Updating physical address of contact #141

@SebastianBecker2

Description

@SebastianBecker2

Got some problems updating a contacts physical address.

ews::indexed_property_path path = ews::contact_property_path::physical_addresses_business;
ews::physical_address address(ews::physical_address::key::business, "Street", "City", "State", "Country", "PostalCode");
ews::property prop(path, address);
ews::update up(prop);

This results in the following message:

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages" xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types">
	<soap:Header>
		<t:RequestServerVersion Version="Exchange2010"/>
	</soap:Header>
	<soap:Body>
		<m:UpdateItem MessageDisposition="SaveOnly" ConflictResolution="AlwaysOverwrite" SendMeetingInvitationsOrCancellations="SendToNone">
			<m:ItemChanges>
				<t:ItemChange>
					<t:ItemId Id="[item_id.id of contact here]" ChangeKey="[item_id.change_key of contact here]"/>
					<t:Updates>
						<t:SetItemField>
							<t:FieldURI FieldURI="contacts:Surname"/>
							<t:Contact>
								<t:Surname>surname</t:Surname>
							</t:Contact>
						</t:SetItemField>
						<t:SetItemField>
							<t:IndexedFieldURI FieldURI="contacts:PhysicalAddresses" FieldIndex="Business"/>
							<t:Contact>
								<t:PhysicalAddresses>
									<t:Entry Key="Business">
										<t:Street>Street</t:Street>
										<t:City>City</t:City>
										<t:State>State</t:State>
										<t:CountryOrRegion>Country</t:CountryOrRegion>
										<t:PostalCode>PostalCode</t:PostalCode>
									</t:Entry>
								</t:PhysicalAddresses>
							</t:Contact>
						</t:SetItemField>
					</t:Updates>
				</t:ItemChange>
			</m:ItemChanges>
		</m:UpdateItem>
	</soap:Body>
</soap:Envelope>

but the exchange server returns this:

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
	<s:Body>
		<s:Fault>
			<faultcode xmlns:a="http://schemas.microsoft.com/exchange/services/2006/types">a:ErrorInvalidRequest</faultcode>
			<faultstring xml:lang="de-DE">Die Anforderung ist ung├╝ltig.</faultstring>
			<detail>
				<e:ResponseCode xmlns:e="http://schemas.microsoft.com/exchange/services/2006/errors">ErrorInvalidRequest</e:ResponseCode>
				<e:Message xmlns:e="http://schemas.microsoft.com/exchange/services/2006/errors">Die Anforderung ist ung├╝ltig.</e:Message>
			</detail>
		</s:Fault>
	</s:Body>
</s:Envelope>

Updating other properties of a contact isn't a problem. Event indexed properties like phone_numbers or something works fine.
But physical addresses are the only index property that consists of more than a single value.
And I have a hard time finding something useful in Microsofts ews docu regarding updating those values. The examples are so dumped down that they are barely useful at all.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions