Apps for Office: my task pane app doesn't get the licensing '?et=' license token

帅比萌擦擦* 提交于 2019-12-11 11:44:25

问题


MSDN docs say:

The Office application calling you app's URL would add the following query string to it and then pass the URL: http://fooservice.com/index.htm?et= PAByAD4APAB0ACAAYQBpAGQAPQ .... (->this string goes on for a while - Mihaly KR)

I've tried everything, but nothing gets ever POSTed (or GETted), no ?et parameter.

The app loads fine in Office, but I want to get the client id from the token, so I could do a permanent storage on my server. I did a php page which prints all get and post parameters, and set it as the APP source, so I can see, what is getting posted.

My manifest file taskpaneapp.xml

<?xml version="1.0" encoding="utf-8"?>
<OfficeApp xmlns="http://schemas.microsoft.com/office/appforoffice/1.0" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xsi:type="TaskPaneApp">
  <Id>08afd7fe-1631-42f4-84f1-5bc51e242f98</Id>
  <Version>1.0</Version>
  <ProviderName>Microsoft</ProviderName>
  <DefaultLocale>EN-US</DefaultLocale>
  <DisplayName DefaultValue="Get token"/>
  <Description DefaultValue="Test app for getting token"/>
  <IconUrl DefaultValue=
    "http://officeimg.vo.msecnd.net/_layouts/images/general/office_logo.jpg"/>
  <Capabilities>
    <Capability Name="Document"/>
    <Capability Name="Workbook"/>
  </Capabilities>
  <DefaultSettings>    
    <SourceLocation DefaultValue="http://taskpaneapp.misc.dev.nomo.hu/print_r.php"/>    
  </DefaultSettings>
  <Permissions>ReadWriteDocument</Permissions>
</OfficeApp>

My token file taskpaneapp.tok

<r>
  <t 
    aid="WA900006056" 
    pid="{08afd7fe-1631-42f4-84f1-5bc51e242f98}" 
    cid="32F3E7FC559F4F49" 
    did="{0672BAE9-B41B-48FE-87F1-7F4D3DD3F3B1}" 
    ts="30" 
    et="Trial" 
    ad="2012-01-12T21:58:13Z" 
    ed="2012-06-30T21:58:13Z" 
    sd="2012-01-12T00:00:00Z" 
    te="2012-06-30T02:49:34Z" />
  <d>VNNAnf36IrkyUVZlihQJNdUUZl/YFEfJOeldWBtd3IM=</d>
</r>

MSDN docs are inconsistent on the token file schema, some use {}s in pid and did some does not. I've tried both, none of them worked.

my registry entry is:

key: taskpaneapp
value: \\NOMONAS\....\taskpaneapp.xml

I tried

key: entry1
value: \\NOMONAS\.....\taskpaneapp.xml

too, it didn't work.

Are the MSDN docs outdated? Don't think so, they were updated in Febr, 2014 and are said to be compatible with Office Apps JS API 1.0 and 1.1

Anyone having the same issues?

Please help me if you have any suggestions, or faced the same problems. Any suggestion would be greatly appreciated.


update 1: So I figured out that token file is successfully read by Office.

When setting license status to "Trial", a notification appears on the top left corner of the task pane app when started. MSDN documentation is very confusing, here it says, that token file pid param must be in brackets, here it is used without brackets. After a lot of trial and error, it turns out that token file is only read if the pid is in brackets.

Bottom line, I changed my .tok file to have pid="{08afd7fe-1631-42f4-84f1-5bc51e242f98}" in it. I guess I'll take the Token Schema page to be true, so I changed the cid and aid attributes to also include {}-s.

But I still don't get the ?et parameter.


回答1:


Turns out this is an Office bug (duh). In this forum post, microsoft official says the following:

After my research it seems that this is a "known issue" with Office 15 SP1 because of which apps loaded from the registry are not getting et returned as expected.

Workaround:

put the ?et get parameter right into your xml, and forget everything MSDN docs told you about the .tok file and editing the registry.

<SourceLocation DefaultValue= “http://myofficeapp.com?et=<base64 encoded token>”

For your convenience, here is a sample token string from MSDN docs

http://myApp/index.htm?et=PAByAD4APAB0ACAAYQBpAGQAPQAiAFcAQQAxADAAMgA4ADkAOQA1ADYANgAiACAAcABpAGQAPQAiADMAZAAyADgANwAwADcAYQAtAGYAYwBjAGUALQA0ADUAMQA3AC0AYQBjADYAZQAtAGMAYQAwAGEAZABkADYAMwA3ADMAYQBhACIAIABjAGkAZAA9ACIAMgAzAEEANwBFAEIAOABBADQAQwA0ADcARgA1AEEAMgAiACAAdABzAD0AIgAwACIAIABzAGwAPQAiAHQAcgB1AGUAIgAgAGUAdAA9ACIARgByAGUAZQAiACAAYQBkAD0AIgAyADAAMQAyAC0AMAA1AC0AMgAyAFQAMQA4ADoAMQAyADoAMgAzAFoAIgAgAHMAZAA9ACIAMgAwADEAMgAtADAANQAtADIAMgAiACAAdABlAD0AIgAyADAANgA3AC0AMAAyAC0AMgAzAFQAMQA4ADoAMQA0ADoAMAAwAFoAIgAgAC8APgA8AGQAPgAyADIAWABLAEEAdgA0ADMAQgBtAHMAcwByADAAcgBxADUANQBGAHUAdgBpAFUAVgBSAGkAVgBLAFMASQBEAGcAeAAyAHAAMgA0AFoAZwBzAGwANgBNAD0APAAvAGQAPgA8AC8AcgA%2bAA%3d%3d


来源:https://stackoverflow.com/questions/24991609/apps-for-office-my-task-pane-app-doesnt-get-the-licensing-et-license-token

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!