2

Microsoft.Lync.Model.Contact.GetContactInformation()メソッドを使用しようとしています。2つのバージョンがあります。1つは単純な列挙型を取り、もう1つは複数の値を持つIEnumerableを取ります。

http://msdn.microsoft.com/en-us/library/lync/hh347568.aspx

最初のバージョンは半成功して使用できますが(値のないバージョンを取得しようとするまで)、複数の引数を渡すことになっている方法がわかりません。

$contactInfo = $c[$c.Count - 1].Participants[1].Contact.GetContactInformation([int[]]("FirstName", "LastName", "DisplayName", "PrimaryEmailAddress"))

(上記は機能しません。)

誰かが私を正しい方向に動かすことができますか?

4

3 に答える 3

4

最も単純な構文は、現在の構文に近いものになります。このメソッドは値の列挙を受け取るContactInformationTypeため、キャストは値ではなく、値の配列にする必要がありますint

$foobar[-1]また、の砂糖として使用することもできます$foo[$foo.Count - 1]。つまり、最後の要素を取得するために使用できます。

$contactInfo = $c[-1].Participants[1].Contact.GetContactInformation([Microsoft.Lync.Model.ContactInformationType[]] @("FirstName", "LastName", "DisplayName", "PrimaryEmailAddress"))
于 2013-03-06T20:45:35.127 に答える
2

以下のようなことを試してみればうまくいくと思います。

$contactInfo = $c[$c.Count - 1].Participants[1].Contact.GetContactInformation(
                [int[]](
                        [int]Microsoft.Lync.Model::ContactInformationType.FirstName,
                        [int]Microsoft.Lync.Model::ContactInformationType.LastName,
                        [int]Microsoft.Lync.Model::ContactInformationType.DisplayName,
                        [int]Microsoft.Lync.Model::ContactInformationType.PrimaryEmailAddress))
于 2013-03-06T19:33:16.357 に答える
1

メソッド自体は、おそらく「FirstName」が何であるかを知りません。次のような列挙値の配列を作成してみてください。

$information = [Microsoft.Lync.Model.ContactInformationType]::FirstName, [Microsoft.Lync.Model.ContactInformationType]::LastName, [Microsoft.Lync.Model.ContactInformationType]::DisplayName, [Microsoft.Lync.Model.ContactInformationType]::PrimaryEmailAddress
$contactInfo = $c[$c.Count - 1].Participants[1].Contact.GetContactInformation($information)
于 2013-03-06T19:49:38.133 に答える