Share via


User.IsCurrentUser method

Gets whether the specified user is the current user.

Namespace:  Microsoft.Office.InfoPath
Assembly:  Microsoft.Office.InfoPath (in Microsoft.Office.InfoPath.dll)

Syntax

'Declaration
Public MustOverride Function IsCurrentUser ( _
    userName As String _
) As Boolean
'Usage
Dim instance As User
Dim userName As String
Dim returnValue As Boolean

returnValue = instance.IsCurrentUser(userName)
public abstract bool IsCurrentUser(
    string userName
)

Parameters

  • userName
    Type: System.String

    The user's name in the format of domain\username.

Return value

Type: System.Boolean
true if the specified user is the current user; otherwise false.

Remarks

This member can be accessed only by forms running in the same domain as the currently open form, or by forms that have been granted cross-domain permissions.

This type or member can be accessed only from code running in forms opened in Microsoft InfoPath Filler.

Examples

In the following example, clicking the Button control displays whether the specified user is the current user.

public void CTRL1_Clicked(object sender, ClickedEventArgs e)
{
   MessageBox.Show(
      this.Application.User.IsCurrentUser(
      "CONTOSO\\markus").ToString());
}
Public Sub CTRL1_Clicked(ByVal sender As Object, _
   ByVal e As ClickedEventArgs)
   MessageBox.Show( _
      Me.Application.User.IsCurrentUser("CONTOSO\markus").ToString())
End Sub

See also

Reference

User class

User members

Microsoft.Office.InfoPath namespace