次の方法で共有


User2.UserName プロパティ

ユーザーのユーザー名のみを取得します。

名前空間: Microsoft.Office.Interop.InfoPath
アセンブリ: Microsoft.Office.Interop.InfoPath (microsoft.office.interop.infopath.dll 内)

構文

'宣言
<DispIdAttribute(4)> _
ReadOnly Property UserName As String
'使用
Dim instance As User2
Dim value As String

value = instance.UserName
[DispIdAttribute(4)] 
string UserName { get; }

プロパティ値

ユーザーのユーザー名。

コメント

UserName プロパティを呼び出すことは、System.Environment.UserName を呼び出すことと同じです。

次の例では、UserName プロパティを使用して、現在のユーザーのログイン資格情報を表示しています。

User2 thisUser = thisApplication.User;
thisXDocument.UI.Alert(thisUser.UserName);
Dim thisUser As User2  = thisApplication.User
thisXDocument.UI.Alert(thisUser.UserName)

関連項目

参照

User2 インターフェイス
User2 のメンバ
Microsoft.Office.Interop.InfoPath 名前空間