开发者

Exchange Web Services authentication problem against Office 365

I'm in the process of developing my first Orchard CMS module, which will interface with Exchange Server for the purpose of adding Exchange Task functionality to Orchard (basically providing web management of personal Tasks). Unfortunately, I don't think Office 365 supports the type of authentication required. This Microsoft document outlines some instructions on setting up a service account with impersonation rights, in order to use Exchange Web Services.

Unfortunately, I need to be able to run the "New-ManagementRoleAssignment" cmdlet, in order to assign the impersonation rights. The error I'm receiving when attempting this cmdlet is:

The term 'New-ManagementRoleAssignment' is not recognized as the name of a cmdlet, function, script file, or operable program.

I'm definetely connected properly, as instructed in that previous URL. Everything I'm reading suggests that this command should be available. Am I missing something? I'm using the Enterprise version of Office 365, in case that matters. The acc开发者_如何学编程ount that I'm using to log in with PowerShell is my global admin account.

Any help and/or insight would be very much appreciated! I have a support in with Microsoft as well, so I'll post anything I get back from them.

Vito

[EDIT] I've decided to add some code, for those who have an Exchange Server and are interested in trying this out. You'll have to download the Exchange Web Services dll, in order to make use of the namespace Microsoft.Exchange.WebServices.

using Microsoft.Exchange.WebServices.Data;
using Microsoft.Exchange.WebServices.Autodiscover;

private static ExchangeService _service;
private static void ConnectToExchangeService()
{
    _service = new ExchangeService(ExchangeVersion.Exchange2010_SP1);
    _service.TraceEnabled = true;
    _service.Credentials = new System.Net.NetworkCredential("me@domain.com", "password");

    AutodiscoverService ads = new AutodiscoverService();
    ads.EnableScpLookup = false;
    ads.RedirectionUrlValidationCallback = delegate { return true; };
    GetUserSettingsResponse grResp = ads.GetUserSettings("me@domain.com", UserSettingName.ExternalEwsUrl);
    Uri casURI = new Uri(grResp.Settings[UserSettingName.ExternalEwsUrl].ToString());
    _service.Url = casURI;

    ControllerContext ctx = new ControllerContext();
    ctx.HttpContext.Response.Write("Server Info: " + _service.ServerInfo.VersionString);
    ctx.HttpContext.Response.Flush();
}


AFAIK, the cmdlet New-ManagementRoleAssignment is not available for the Small Business Plan (P1) on Office 365. However, the administrator is assigned impersonation rights by default so you have to connect with the administrator credentials.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜