Правильный способ завершения встречи для всех участников Skype для бизнеса с помощью Lync SDK

2

Я пытаюсь реализовать функцию для завершения текущей беседы для всех участников с помощью Microsoft Lync SDK для Skype для бизнеса. Предполагалось, что работа должна быть выполнена следующим образом:

conversation.End();

Но он закрывает только окно участника, который начал собрание. Есть ли другой способ сделать это?

Теги:
skype-for-business
lync-client-sdk

1 ответ

0

Метод "Конец" просто покидает конференцию, как вы говорите.

Для "Окончательного собрания" нет документального API.

Если вы действительно хотите сделать это программно, вам нужно будет использовать что-то вроде Windows Automation, чтобы выбрать кнопку "Дополнительные параметры", а затем выбрать кнопку "Завершить собрание".

Ниже приведен пример использования автоматической автоматизации Windows для нажатия кнопки "Завершить встречу".

bool EndMeeting(ConversationWindow window)
{
    var conversationWindowElement = AutomationElement.FromHandle(window.InnerObject.Handle);
    if (conversationWindowElement == null)
    {
        return false;
    }

    AutomationElement moreOptionsMenuItem;
    if (GetAutomationElement(conversationWindowElement, out moreOptionsMenuItem, "More options", ControlType.MenuItem))
    {
        (moreOptionsMenuItem.GetCurrentPattern(ExpandCollapsePattern.Pattern) as ExpandCollapsePattern).Expand();
    }
    else if (GetAutomationElement(conversationWindowElement, out moreOptionsMenuItem, "More options", ControlType.Button))
    {
        // in the Office 365 version of lync client, the more options menu item is actually a button
        (moreOptionsMenuItem.GetCurrentPattern(InvokePattern.Pattern) as InvokePattern).Invoke();
    }
    else
    {
        // didn't find it.
        return false;
    }

    AutomationElement menuOptionAction;
    if (!GetAutomationElement(moreOptionsMenuItem, out menuOptionAction, "End Meeting", ControlType.MenuItem))
    {
        return false;
    }

    (menuOptionAction.GetCurrentPattern(InvokePattern.Pattern) as InvokePattern).Invoke();
    return true;
}

private static bool GetAutomationElement(AutomationElement rootElement, out AutomationElement resultElement, string name, ControlType expectedControlType)
{
    Condition propCondition = new PropertyCondition(AutomationElement.NameProperty, name, PropertyConditionFlags.IgnoreCase);
    resultElement = rootElement.FindFirst(TreeScope.Subtree, propCondition);
    if (resultElement == null)
    {
        return false;
    }

    var controlTypeId = resultElement.GetCurrentPropertyValue(AutomationElement.ControlTypeProperty) as ControlType;
    if (!Equals(controlTypeId, expectedControlType))
    {
        return false;
    }

    return true;
}

Ещё вопросы

Сообщество Overcoder
Наверх
Меню