OfficeDev / office-js

A repo and NPM package for Office.js, corresponding to a copy of what gets published to the official "evergreen" Office.js CDN, at https://appsforoffice.microsoft.com/lib/1/hosted/office.js.
https://learn.microsoft.com/javascript/api/overview
Other
648 stars 92 forks source link

Office Add-in MS Project Task pane : Permission denied #631

Closed ragavanrajan closed 4 years ago

ragavanrajan commented 4 years ago

After a recent update yesterday (18-Jul-19) . I am getting permission denied for any Office JS method when I try to execute.

Expected Behavior

Changing the selected task to desired text as per the below function.

Current Behavior

In my manifest I have checked the permission is set to: <Permissions>ReadWriteDocument</Permissions>

Steps to Reproduce, or Live Example

Below is the sample method which use to run fine

// Get the GUID of the selected task Office.context.document.getSelectedTaskAsync( function (result) { if (result.status === Office.AsyncResultStatus.Succeeded) { taskGuid = result.value;

        // Set the specified fields for the selected task.
        var targetFields = [Office.ProjectTaskFields.Name, Office.ProjectTaskFields.Notes];
        var fieldValues = ['Tidy International Task', 'Notes for the task from Tidy.'];

        // Set the field value. If the call is successful, set the next field.
        for (var i = 0; i < targetFields.length; i++) {
          Office.context.document.setTaskFieldAsync(
              taskGuid,
              targetFields[i],
              fieldValues[i],
              function (result) {
                if (result.status === Office.AsyncResultStatus.Succeeded) {
                  i++;
                }
                else {
                  var err = result.error;
                  console.log(err.name + ' ' + err.code + ' ' + err.message);
                }
              }
          );
        }
      } else {
        var err = result.error;
        console.log(err.name + ' ' + err.code + ' ' + err.message);
      }
    }
);

}


<!--- How has this issue affected you? What are you trying to accomplish? -->
<!--- Providing context helps us come up with a solution that is most useful in the real world -->

## Your Environment
<!--- Include as many relevant details about the environment you experienced the bug in -->

Windows 10 64-bit
**MS Project for Office 365 MSO (16.0.11328.20362) 64-bit**
Word for Office 365 MSO (16.0.11328.20362) 64-bit
Actually for all office product the above version is applicable.
IE 11 BROWSER 

## Useful logs
<!--- Please include any of the following logs that may help us debugging your issue -->
- [ ] Console errors
- [x ] Screenshots
- [ ] Test file (if only happens on a particular file)
![image](https://user-images.githubusercontent.com/6369107/61491022-60129d80-aa02-11e9-8ffd-ab0e1cbb0ce6.png)

More detailed screenshot: Even though write privilleges is declared, function is falling under rejection 

![image](https://user-images.githubusercontent.com/6369107/61493068-d7e2c700-aa06-11e9-9c6c-65764f21f362.png)

Kindly help to fix this problem ASAP. Thanks 
cyrelk commented 4 years ago

I confirm , this was the bug I closed before too soon. In fact it's now impossible to run add-ins on Windows 7. We must migrate all our machines from Windows 7 to Windows 10 1903, at the very least, to get the applications working again. Reinstalling Office, latest version, on windows 7 machines does not correct the problem. Apparently the move from Internet Explorer to Edge seems to be the culprit.

ragavanrajan commented 4 years ago

So does it mean. Add-in will only work in edge without any issues? I understand browsers will be decided based on the office version on Windows 10. If that is the case how do I force add in to use edge browser?

cyrelk commented 4 years ago

On Windows 10 1903 I see the add-ins using Edge on 1809 they use IE. Apparently this is completly automatic. Maybe the Office developers could answer. In fact it was by trying to debug the application on my machine that I remarked I could not used the F12 IE debugger anymore but I must use the Edge DevTools. I didn't know about the switch before that.

niteshgolchha85 commented 4 years ago

Can you confirm if you are using the latest version of office.js?

ragavanrajan commented 4 years ago

@niteshgolchha85 yes. Using the following CDN. <script src="https://appsforoffice.microsoft.com/lib/1/hosted/Office.js" type="text/javascript"></script>. I hope there is no update after this!!

ragavanrajan commented 4 years ago

Even The Addins written in VSTO for MS Project is also stopped working. Producing errors on existing functionality. Affecting all production users. . Below is the MSO version for better clarity.

image image

cyrelk commented 4 years ago

Works again for me on the latest revision of the GIT version of OfficeJS. Including on Windows 7 machines.

ragavanrajan commented 4 years ago

@cyrelk Could you please share the CDN you are using.

cyrelk commented 4 years ago

I'm using the GIT version , latest revision.

ragavanrajan commented 4 years ago

@cyrelk sorry little confused. would you mind sharing link or reference pls. I have tried the <script src="https://unpkg.com/@microsoft/office-js@1.1.2-alpha.0/dist/office.js"></script> still ending up with error. What is the one you are using. Can you please be specific.

cyrelk commented 4 years ago

That's the one you get from this very site: https://github.com/OfficeDev/office-js.git The little green button in the upper right of code section :)

niteshgolchha85 commented 4 years ago

@ragavanrajan referencing the CDN is the best way to get the latest office.js. You can try grabbing it from the location that @cyrelk mentioned above to see if that works or check if there are no other references to office.js in your code.

ragavanrajan commented 4 years ago

@niteshgolchha85 : I have checked completely every where in my application. Office JS is not referenced any where else. Using the latest CDN <script src="https://unpkg.com/@microsoft/office-js@1.1.29/dist/office.js"></script> - I am still getting the permission denied error. Even the samples are also having same problem. Could you please provide any alternative. Thanks

htryggva commented 4 years ago

We are also seeing this problem suddenly occurring on our add-ins on these environments:

cyrelk commented 4 years ago

As I have already written above the two solutions we found to correct that problem were:

niteshgolchha85 commented 4 years ago

At this point, @jargil is the best person to help out. I suspect it could be Edge caching old office.js but I'd let @jargil provide his opinion.

niteshgolchha85 commented 4 years ago

Question from engineering: what is the url for this file: project-win32-16.0x?

ragavanrajan commented 4 years ago

@niteshgolchha85 Here is the requested information : "?_host_Info=Project$Win32$16.01$en-US"

htryggva commented 4 years ago

@niteshgolchha85 On my environment the url is: https://appsforoffice.microsoft.com/lib/1/hosted/project-win32-16.00.js

Project Version 1908 (Office Insider) Windows Version 1903

Further note: On my machine, IE is being used for the WebView on MS Project. Edge is being used on the other Office apps. Is that normal?

jjhua-github commented 4 years ago

@htryggva Do you have the "permission denied" problem or something else? Can you double check you are not getting project-win32-16.01? What is osf.dll version? It is next to your Project product executable file. See the picture below. image

@ragavanrajan Can you confirm you are getting https://appsforoffice.microsoft.com/lib/1.1/hosted/project-win32-16.01.js or https://appsforoffice.microsoft.com/lib/1/hosted/project-win32-16.01.js? It would be great if you can tell me your osf.dll version as well.

htryggva commented 4 years ago

@jjhua-github I'm getting the "permission denied" error when trying to opening a dialog using the DialogAPI.

I'm getting the 16.00 version:

image

osf.dll: image

Hope this helps! Let me know if you need any more info.

ragavanrajan commented 4 years ago

@jjhua-github sure. Here is the requested information

Request URL: https://appsforoffice.microsoft.com/lib/1.1/hosted/project-win32-16.00.js

image

OSF.DLL:

image

Please let me know if you need any further info.

jargil commented 4 years ago

@htryggva - regarding Project not using Edge WebView, that's unexpected, I'm looking into this. As always, thanks for reporting!

jargil commented 4 years ago

Not Edge related, so assigning to @jjhua-github.

jjhua-github commented 4 years ago

Sorry, we have a bug in https://appsforoffice.microsoft.com/lib/1/hosted/project-win32-16.00.js and https://appsforoffice.microsoft.com/lib/1.1/hosted/project-win32-16.00.js. We are working on fix right now. ETA: next week the fix will be on dogfood CDN; a week later on public CDN.

AllepuRajkumar commented 4 years ago

I'm also facing the same issue, while adding task pane add-in to MS Project.

image

MS Project Client details:

image

binarykitchen commented 4 years ago

@jjhua-github it's been 18 days ... is this fix out yet?

ragavanrajan commented 4 years ago

@binarykitchen I think the thread is not updated. It started working on the above reported build. Could you please check.

binarykitchen commented 4 years ago

Right, latest version //unpkg.com/@microsoft/office-js@1.1.29/dist/office.js resolves this.

jargil commented 4 years ago

This fix is getting deployed already. Thanks everyone who confirmed is working now.

htryggva commented 4 years ago

@jargil @jjhua-github I can confirm that it's working for me (Version 1908). Thanks!

BlackStef commented 4 years ago

Hello,

I'm having the same issue when I try to host my add-in with https. I get a RichApi.Error : AccessDenied, but It's working when I disable the https on my server. This issue happen when I try to get some data from my excel workbook with my add-in.

For information It's hosted with an nginx container on a docker server. My excel version is 1902 and my office-js version is 1.0.31

Do you have some information about this issue ?

Thank you in advance ! :)

jargil commented 4 years ago

This issue has been long resolved, so please follow the conversation above to make sure you have all the patches/updates installed.

Otherwise please wait for your new issue to be triaged and assigned to someone to try to help you.