SPUtility.FormatAccountName Method (String)

Retrieves a concatenated string containing the provider and user values in order, separated by a colon (":"). This method retrieves the concatenated string based only on the user name.

Namespace:  Microsoft.SharePoint.Utilities
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Available in Sandboxed Solutions: Yes
Available in SharePoint Online

Syntax

'Declaration
Public Shared Function FormatAccountName ( _
    user As String _
) As String
'Usage
Dim user As String
Dim returnValue As String

returnValue = SPUtility.FormatAccountName(user)
public static string FormatAccountName(
    string user
)

Parameters

  • user
    Type: System.String

    A string providing the name of the user.

Return Value

Type: System.String
A concatenation of the provider and user strings, in order, separated by a colon (":").

Remarks

This method calls the FormatAccountName(String, String) method, passing it the Membership.Provider.Name value for the first parameter. That method validates provider and user values before concatenating the strings. If either of the provider or user values is empty or null, the System.ArgumentNullException exception is thrown. If the provider string contains a colon (":"), the System.ArgumentException exception is thrown.

See Also

Reference

SPUtility Class

SPUtility Members

FormatAccountName Overload

Microsoft.SharePoint.Utilities Namespace