UserProfileService.AddMembership Method
Adds the specified account name as a new member of the specified group.
Namespace: [UserProfileService Web service]
Web service reference: http://Site/_vti_bin/UserProfileService.asmx
Syntax
'Declaration
<SoapDocumentMethodAttribute("https://microsoft.com/webservices/SharePointPortalServer/UserProfileService/AddMembership", RequestNamespace := "https://microsoft.com/webservices/SharePointPortalServer/UserProfileService", _
ResponseNamespace := "https://microsoft.com/webservices/SharePointPortalServer/UserProfileService", _
Use := SoapBindingUse.Literal, ParameterStyle := SoapParameterStyle.Wrapped)> _
Public Function AddMembership ( _
accountName As String, _
membershipInfo As MembershipData, _
group As String, _
privacy As Privacy _
) As MembershipData
'Usage
Dim instance As UserProfileService
Dim accountName As String
Dim membershipInfo As MembershipData
Dim group As String
Dim privacy As Privacy
Dim returnValue As MembershipData
returnValue = instance.AddMembership(accountName, _
membershipInfo, group, privacy)
[SoapDocumentMethodAttribute("https://microsoft.com/webservices/SharePointPortalServer/UserProfileService/AddMembership", RequestNamespace = "https://microsoft.com/webservices/SharePointPortalServer/UserProfileService",
ResponseNamespace = "https://microsoft.com/webservices/SharePointPortalServer/UserProfileService",
Use = SoapBindingUse.Literal, ParameterStyle = SoapParameterStyle.Wrapped)]
public MembershipData AddMembership(
string accountName,
MembershipData membershipInfo,
string group,
Privacy privacy
)
Parameters
accountName
Type: System.StringThe account name of the user to add to the group.
membershipInfo
Type: [UserProfileService Web service].MembershipDataThe information about the membership.
group
Type: System.StringThe name of the group to which the user is added.
privacy
Type: [UserProfileService Web service].PrivacyThe privacy level of the group.
Return Value
Type: [UserProfileService Web service].MembershipData
Information about the new membership.
Exceptions
Exception | Condition |
---|---|
SoapException | The link cannot be added. |
Remarks
This method creates a new membership with the specified information for the user specified by the accountName parameter, and returns the information about the newly added membership.