2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Skype for BusinessにExcelからアクセスしてみる

Last updated at Posted at 2019-09-11

なぜかSlackやTeamsを差し置いて社内導入されてしまったSkype for BusinessになんとかExcelからアクセスできないものか模索してみました。

なお、下記を試して情報システムに睨まれるようになっても当方は一切関知しません。自己責任でお願いします。

前準備

  • .NET Framework 4.0環境

  • Excel-DNA一式
    ExcelDna.xllは作成するdnaファイル名に合わせてLyncTest.xllに変更。64bit環境の人はExcelDna64.xllの方をリネームしてください。

  • Microsoft.Lync.Model.dll 他一式
      Skype for Businessがインストールされているフォルダから持ってくる。

コード

以下をテキストエディタで作成して、上記のxllと同じフォルダに置いておく。

NMeCabTest.dna
<DnaLibrary RuntimeVersion="v4.0" Name="LyncTest" Description="Using SfB" Language="CS">
<Reference Path="Microsoft.Lync.Model.dll" />
<![CDATA[

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Lync.Model;

public class LyncTest
{
	public static string LyncState()
	{
		var cl = LyncClient.GetClient();
		return cl.State.ToString();
	}

	//状態はPresenceじゃなくてActivityというんですってよ。知らなかった、そんなの…
	public static string GetActivity(string uri)
	{
		var cl = LyncClient.GetClient();
		var c = cl.ContactManager.GetContactByUri(uri);
		return c.GetContactInformation(Microsoft.Lync.Model.ContactInformationType.Activity).ToString();
	}
}
]]>
</DnaLibrary>

使い方

まず、Skype for Businessを起動して、サインインした状態にしておく。
(自前でサインインしようとするとサーバーからアクセスキーを取得してゴニョゴニョやる必要があります)

ワークブックにLyncTest.xllをドラッグ&ドロップして、「このアドインをこのセッションに限り有効にする」を選択しておく。

セルに数式として下記を入力。


=LyncStatus()

"SignedIn"と表示されれば、OK。

同じく、セルに数式として下記を入力。

=GetActivity("SfBにサインインしたアドレス、もしくは調べたい相手のアドレス。普通メールアドレスですかね?")

「連絡可能」とか出てくればOK。

参考

あとがき

メッセージの送信もできるようになれば便利になる…、のかなぁ。

2
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?