SPUtility.FormatAccountName method (String, String)

Validates the provider and user string values. If these strings are valid, this method concatenates the provider and user values in order, with a colon (":") between them, and returns the concatenated string.

Namespace:  Microsoft.SharePoint.Utilities
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)

public static string FormatAccountName(
	string provider,
	string user
)

Parameters

provider
Type: System.String

A string that provides the name of the provider.

user
Type: System.String

A string that provides the user name.

Return value

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

If either of the provider or user values is empty or null, this method throws an exception of ArgumentNullException. If the provider string contains a colon (":"), this method throws an error of System.ArgumentException.

Show: