我做了一个Office Add,通过Razor页面.Net Core应用程序获取页面。我正在使用AspNetCore.Identity进行身份验证。它具有此URL(“ https://localhost:44311/Identity/Account/Login”)作为默认登录页面。在我的Outlook客户端中,您可以按预期工作,但是在Outlook Web上不会加载“添加ir”。
我尝试加载匿名页面(无身份验证),并且在Web和本地客户端上均可使用。
我希望:登录页面会加载到Outlook Web中。
实际结果:
提琴手跟踪:https://switch.sharefile.com/d-s61052c062e14e368
清单:
<?xml version="1.0" encoding="UTF-8"?>
<!--Created:ce44715c-8c4e-446b-879c-ea9ebe0f09c8-->
<OfficeApp
xmlns="http://schemas.microsoft.com/office/appforoffice/1.1"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:bt="http://schemas.microsoft.com/office/officeappbasictypes/1.0"
xmlns:mailappor="http://schemas.microsoft.com/office/mailappversionoverrides/1.0"
xsi:type="MailApp">
<!-- Begin Basic Settings: Add-in metadata, used for all versions of Office unless override provided. -->
<!-- IMPORTANT! Id must be unique for your add-in, if you reuse this manifest ensure that you change this id to a new GUID. -->
<Id>dead2ddf-a7ed-49db-8f85-add1b28f16af</Id>
<!--Version. Updates from the store only get triggered if there is a version change. -->
<Version>1.0.0.0</Version>
<ProviderName>Scriptum</ProviderName>
<DefaultLocale>en-NL</DefaultLocale>
<!-- The display name of your add-in. Used on the store and various places of the Office UI such as the add-ins dialog. -->
<DisplayName DefaultValue="Scriptum" />
<Description DefaultValue="Scriptum Outlook plugin for specifying metadata"/>
<IconUrl DefaultValue="https://localhost:44311/images/icon64.png"/>
<SupportUrl DefaultValue="https://gitlab.com/" />
<!-- Domains that will be allowed when navigating. For example, if you use ShowTaskpane and then have an href link, navigation will only be allowed if the domain is on this list. -->
<AppDomains>
<AppDomain>https://localhost:44311</AppDomain>
<AppDomain>https://outlook.office.com</AppDomain>
<AppDomain>https://outlook.live.com</AppDomain>
</AppDomains>
<!--End Basic Settings. -->
<Hosts>
<Host Name="Mailbox" />
</Hosts>
<Requirements>
<Sets>
<Set Name="Mailbox" MinVersion="1.4" />
</Sets>
</Requirements>
<FormSettings>
<Form xsi:type="ItemRead">
<DesktopSettings>
<SourceLocation DefaultValue="https://desktop-5fsll4q:44311/Identity/Account/Login?ReturnUrl=/Outlook/Main"/>
<RequestedHeight>250</RequestedHeight>
</DesktopSettings>
</Form>
</FormSettings>
<Permissions>ReadWriteItem</Permissions>
<Rule xsi:type="RuleCollection" Mode="Or">
<Rule xsi:type="ItemIs" ItemType="Message" FormType="ReadOrEdit" />
</Rule>
<DisableEntityHighlighting>false</DisableEntityHighlighting>
<VersionOverrides xmlns="http://schemas.microsoft.com/office/mailappversionoverrides" xsi:type="VersionOverridesV1_0">
<Requirements>
<bt:Sets DefaultMinVersion="1.4">
<bt:Set Name="Mailbox" />
</bt:Sets>
</Requirements>
<Hosts>
<Host xsi:type="MailHost">
<DesktopFormFactor>
<!-- Location of the Functions that UI-less buttons can trigger (ExecuteFunction Actions). -->
<!--<FunctionFile resid="functionFile" />-->
<!-- Message Read -->
<ExtensionPoint xsi:type="MessageReadCommandSurface">
<!-- Use the default tab of the ExtensionPoint or create your own with <CustomTab id="myTab"> -->
<OfficeTab id="TabDefault">
<!-- Up to 6 Groups added per Tab -->
<Group id="msgReadGroup">
<Label resid="groupLabel" />
<!-- Launch the add-in : task pane button -->
<Control xsi:type="Button" id="msgReadOpenPaneButton">
<Label resid="paneReadButtonLabel" />
<Supertip>
<Title resid="paneReadSuperTipTitle" />
<Description resid="paneReadSuperTipDescription" />
</Supertip>
<Icon>
<bt:Image size="16" resid="icon16" />
<bt:Image size="32" resid="icon32" />
<bt:Image size="80" resid="icon80" />
</Icon>
<Action xsi:type="ShowTaskpane">
<SourceLocation resid="messageReadTaskPaneUrl" />
</Action>
</Control>
<!-- Go to http://aka.ms/ButtonCommands to learn how to add more Controls: ExecuteFunction and Menu -->
</Group>
</OfficeTab>
</ExtensionPoint>
<!-- Go to http://aka.ms/ExtensionPointsCommands to learn how to add more Extension Points: MessageRead, AppointmentOrganizer, AppointmentAttendee -->
</DesktopFormFactor>
</Host>
</Hosts>
<Resources>
<bt:Images>
<bt:Image id="icon16" DefaultValue="https://localhost:44311/images/icon16.png"/>
<bt:Image id="icon32" DefaultValue="https://localhost:44311/images/icon32.png"/>
<bt:Image id="icon80" DefaultValue="https://localhost:44311/images/icon80.png"/>
</bt:Images>
<bt:Urls>
<!--<bt:Url id="functionFile" DefaultValue="https://desktop-5fsll4q:44311/Identity/Account/Login?ReturnUrl=/Outlook"/>-->
<bt:Url id="messageReadTaskPaneUrl" DefaultValue="https://desktop-5fsll4q:44311/Identity/Account/Login?ReturnUrl=/Outlook/Main"/>
</bt:Urls>
<bt:ShortStrings>
<bt:String id="groupLabel" DefaultValue="Scriptum"/>
<!--<bt:String id="customTabLabel" DefaultValue=""/>-->
<bt:String id="paneReadButtonLabel" DefaultValue="Metadata"/>
<bt:String id="paneReadSuperTipTitle" DefaultValue="Scriptum Outlook plugin for specifying metadata"/>
</bt:ShortStrings>
<bt:LongStrings>
<bt:String id="paneReadSuperTipDescription" DefaultValue="Opens a pane displaying all available properties. This is an example of a button that opens a task pane."/>
</bt:LongStrings>
</Resources>
</VersionOverrides>
</OfficeApp>
登录剃刀页面逻辑:
public async Task OnGetAsync(string returnUrl = null)
{
if (!string.IsNullOrEmpty(ErrorMessage))
{
ModelState.AddModelError(string.Empty, ErrorMessage);
}
returnUrl = returnUrl ?? Url.Content("~/");
// Clear the existing external cookie to ensure a clean login process
await HttpContext.SignOutAsync(IdentityConstants.ExternalScheme);
ExternalLogins = (await _signInManager.GetExternalAuthenticationSchemesAsync()).ToList();
if (System.IO.File.Exists((Directory.GetCurrentDirectory() + @"/defaultPassword.txt")))
{
ViewData["defaultPassword"] = Components.Security.Encryptor.DecryptString(System.IO.File.ReadAllText((Directory.GetCurrentDirectory() + @"/defaultPassword.txt")), Data.Constants.Cipher);
}
ReturnUrl = returnUrl;
}