Share via


UserProfileService.AddMembership method

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

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

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.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.

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.

See also

Reference

UserProfileService class

UserProfileService members

WebSvcUserProfileService namespace