# Table of contents:

# Introduction

AddMember is one of the SOAP actions the Contact Sharing Service provides.

Create and add a sharing relationship for one or more member(s) in the specified service.

In Official Client terms, this can add members to the Allow List (AL), Block List (BL) and the Reverse List (RL) (Pending List (PL) members only). For adding a user to the Forward List (FL), read the ABContactAdd article.

# Client/Request

The template used in this action is described on the Address Book Service main page.

# AddMember

This element has only one attribute:

# serviceHandle

This element contains three children:

# memberships

This element only contains <Membership> elements.

# Membership

This element contains two children:

# Members

This element only contains <Member> elements.

# Member

This element has two attributes:

This element contains two children:

This element also contains one of the following mutually exclusive children.

  1. <PassportName>: The user handle associated with this membership.
  2. <Email>: The e-mail address associated with this membership.
  3. <PhoneNumber>: The phone number associated with this membership, in the format of the full phone number (including country code) prefixed with a +.

This element also contains the following children if the <MemberRole> is set to ProfileExpression:

# Server/Response

The template used in this action is described on the Address Book Service main page.

# AddMemberResponse

This empty element has only one attribute:

# Examples

# PassportMember to Messenger service

# Client/Request

POST /abservice/SharingService.asmx HTTP/1.1
SOAPAction: http://www.msn.com/webservices/AddressBook/AddMember
Cache-Control: no-cache
Content-Type: text/xml; charset=utf-8
Content-Length: 1319

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope
	xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xmlns:xsd="http://www.w3.org/2001/XMLSchema"
	xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
>
	<soap:Header>
		<ABApplicationHeader xmlns="http://www.msn.com/webservices/AddressBook">
			<ApplicationID>996CDE1E-AA53-4477-B943-2BE802EA6166</ApplicationID>
			<IsMigration>false</IsMigration>
			<PartnerScenario>Timer</PartnerScenario>
		</ABApplicationHeader>
		<ABAuthHeader xmlns="http://www.msn.com/webservices/AddressBook">
			<ManagedGroupRequest>false</ManagedGroupRequest>
			<TicketToken>t=ticket&amp;p=profile</TicketToken>
		</ABAuthHeader>
	</soap:Header>
	<soap:Body>
		<AddMember xmlns="http://www.msn.com/webservices/AddressBook">
			<serviceHandle>
				<Id>0</Id>
				<Id>Messenger</Id>
				<ForeignId></ForeignId>
			</serviceHandle>
			<memberships>
				<Membership>
					<MemberRole>Allow</MemberRole>
					<Members>
						<Member xsi:type="PassportMember">
							<Type>Passport</Type>
							<State>Accepted</State>
							<Deleted>false</Deleted>
							<PassportName>anotheruser@hotmail.com</PassportName>
						</Member>
					</Members>
				</Membership>
			</memberships>
		</AddMember>
	</soap:Body>
</soap:Envelope>

# Server/Response

HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: 719

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope
	xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xmlns:xsd="http://www.w3.org/2001/XMLSchema"
>
	<soap:Header>
		<ServiceHeader xmlns="http://www.msn.com/webservices/AddressBook">
			<Version>12.01.1111.0000</Version>
			<CacheKey>12r1;MjAyNC0xMS0xOVQxNzo0ODowOS44MDNa</CacheKey>
			<CacheKeyChanged>true</CacheKeyChanged>
			<PreferredHostName>contacts.example.com</PreferredHostName>
			<SessionId>ecfaf8c7-e388-4571-8641-b061a0ac4bdc</SessionId>
		</ServiceHeader>
	</soap:Header>
	<soap:Body>
		<AddMemberResponse xmlns="http://www.msn.com/webservices/AddressBook" />
	</soap:Body>
</soap:Envelope>

# RoleMember to Profile service

# Client/Request

POST /abservice/SharingService.asmx HTTP/1.1
SOAPAction: http://www.msn.com/webservices/AddressBook/AddMember
Cache-Control: no-cache
Content-Type: text/xml; charset=utf-8
Content-Length: 1535

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope
	xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xmlns:xsd="http://www.w3.org/2001/XMLSchema"
	xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
>
	<soap:Header>
		<ABApplicationHeader xmlns="http://www.msn.com/webservices/AddressBook">
			<ApplicationID>AAD9B99B-58E6-4F23-B975-D9EC1F9EC24A</ApplicationID>
			<IsMigration>false</IsMigration>
			<PartnerScenario>RoamingLocalSyncStorage</PartnerScenario>
		</ABApplicationHeader>
		<ABAuthHeader xmlns="http://www.msn.com/webservices/AddressBook">
			<ManagedGroupRequest>false</ManagedGroupRequest>
			<TicketToken>t=ticket&amp;p=profile</TicketToken>
		</ABAuthHeader>
	</soap:Header>
	<soap:Body>
		<AddMember xmlns="http://www.msn.com/webservices/AddressBook">
			<serviceHandle>
				<Id>0</Id>
				<Type>Profile</Type>
				<ForeignId>MyProfile</ForeignId>
			</serviceHandle>
			<memberships>
				<Membership>
					<MemberRole>ProfileExpression</MemberRole>
					<Members>
						<Member xsi:type="RoleMember">
							<Type>Role</Type>
							<State>Accepted</State>
							<Id>Allow</Id>
							<DefiningService>
								<Id>0</Id>
								<Type>Messenger</Type>
								<ForeignId></ForeignId>
							</DefiningService>
							<MaxRoleRecursionDepth>0</MaxRoleRecursionDepth>
							<MaxDegreesSeparationDepth>0</MaxDegreesSeparationDepth>
						</Member>
					</Members>
				</Membership>
			</memberships>
		</AddMember>
	</soap:Body>
</soap:Envelope>

# Server/Response

HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: 719

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope
	xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xmlns:xsd="http://www.w3.org/2001/XMLSchema"
>
	<soap:Header>
		<ServiceHeader xmlns="http://www.msn.com/webservices/AddressBook">
			<Version>12.01.1111.0000</Version>
			<CacheKey>12r1;MjAyNC0xMS0xOVQxNzo0ODowOS44MDNa</CacheKey>
			<CacheKeyChanged>true</CacheKeyChanged>
			<PreferredHostName>contacts.example.com</PreferredHostName>
			<SessionId>ecfaf8c7-e388-4571-8641-b061a0ac4bdc</SessionId>
		</ServiceHeader>
	</soap:Header>
	<soap:Body>
		<AddMemberResponse xmlns="http://www.msn.com/webservices/AddressBook" />
	</soap:Body>
</soap:Envelope>