UserProfileService.AddMembership method

Adds the specified account name as a new member of the specified group.

Namespace:  WebSvcUserProfileService
Assembly:  UserProfileServices (in UserProfileServices.dll)


<SoapDocumentMethodAttribute("", RequestNamespace := "",  _
    ResponseNamespace := "",  _
    Use := SoapBindingUse.Literal, ParameterStyle := SoapParameterStyle.Wrapped)> _
Public Function AddMembership ( _
    accountName As String, _
    membershipInfo As MembershipData, _
    group As String, _
    privacy As Privacy _
) As MembershipData
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("", RequestNamespace = "", 
    ResponseNamespace = "", 
    Use = SoapBindingUse.Literal, ParameterStyle = SoapParameterStyle.Wrapped)]
public MembershipData AddMembership(
    string accountName,
    MembershipData membershipInfo,
    string group,
    Privacy privacy


  • accountName
    Type: System.String

    The account name of the user to add to the group.

  • group
    Type: System.String

    The name of the group to which the user is added.

Return value

Type: WebSvcUserProfileService.MembershipData
Information about the new membership.


Exception Condition

The link cannot be added.


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.

See also


UserProfileService class

UserProfileService members

WebSvcUserProfileService namespace