这是我部署的内容:
testRedirect
是一个空的网站.所有子应用程序都是已在应用程序中转换的子文件夹.所有这些都是ASP .Net MVC网站.
这是我想要设置的内容:
Http://localhost/
必须显示内容SiteName1
而不Http://localhost/SiteName1/
在地址栏中显示(必须保留Http://localhost/
)
Http://localhost/SiteName1/
必须显示内容SiteName1
而不Http://localhost/SiteName1/
在地址栏中显示(必须保留Http://localhost/
)
Http://localhost/SiteName2/
显示地址栏中的内容SiteName2
和显示Http://localhost/SiteName2/
(SiteName3
和&SiteName4
和任何其他网站的相同行为......)
换句话说,我希望我SiteName1
的行为像一个家庭网站
到目前为止我尝试过的是类似@cheesemacfly 在这里提供的答案:
<rules>
<rule name="Redirect if SiteName1" stopProcessing="true">
<match url="^SiteName1/(.*)$" />
<action type="Redirect" url="{R:1}" />
</rule>
<rule name="Rewrite to sub folder">
<match url="^.*$" />
<action type="Rewrite" url="SiteName1/{R:0}" />
</rule>
</rules>
Run Code Online (Sandbox Code Playgroud)
它适用于Case1和2,但不适用于其他.
我试图添加像这样的规则,但它没有成功......
<rule name="if_not_SiteName1" stopProcessing="true">
<match url="^SiteName1/(.*)$" negate="true" />
<action type="None" /> …
Run Code Online (Sandbox Code Playgroud) 我开发了一个工作正常的Outlook Web加载项.这是一个Taskpane,可以在约会的撰写模式中使用,它可以收集事件的数据,添加一些数据并将其全部发送到某个API.
我现在要做的是将经过身份验证的用户订阅到Outlook Rest API,以便在删除事件时收到通知.
订阅调用应该如下所示:
POST https://outlook.office.com/api/v2.0/me/subscriptions HTTP/1.1
Content-Type: application/json
{
@odata.type:"#Microsoft.OutlookServices.PushSubscription",
Resource: "https://outlook.office.com/api/v2.0/me/events",
NotificationURL: "https://myNotifAPI.azurewebsites.net/api/send/myNotifyClient",
ChangeType: "Deleted",
ClientState: "blabla"
}
Run Code Online (Sandbox Code Playgroud)
我知道我需要在发布到订阅URL时提供有效的身份验证承载令牌,因此我尝试在我的加载项中调用此方法:
_mailbox = Office.context.mailbox;
_mailbox.getUserIdentityTokenAsync(getUserIdentityTokenCallback);
Run Code Online (Sandbox Code Playgroud)
在函数中getUserIdentityTokenAsync
,我调用一个WebApi Controller来验证我的令牌并将其发送回加载项:
AppIdentityToken token = (AppIdentityToken)AuthToken.Parse(rawToken);
token.Validate(new Uri(request.AudienceUrl));
return token;
Run Code Online (Sandbox Code Playgroud)
我试图使用该令牌发布到https://outlook.office.com/api/v2.0/me/subscriptions
(使用Postman),但我得到了401说:
reason="The audience claim value is invalid '<MyAddInURL>'.";error_category="invalid_resource"
Run Code Online (Sandbox Code Playgroud)
它是在特定情况下使用的正确令牌还是我需要另一个?任何建议将不胜感激!
- 编辑 -
正如@ benoit-patra所建议的那样,我尝试使用getCallbackTokenAsync
而不是使用令牌,getUserIdentityTokenAsync
但是当我打电话时,https://outlook.office.com/api/v2.0/me/subscriptions
我确实收到了403:
"error": {
"code": "ErrorAccessDenied",
"message": "The api you are trying to access does not support item scoped OAuth."
} …
Run Code Online (Sandbox Code Playgroud) office-addins outlook-addin outlook-restapi office-js outlook-web-addins