{"action":"created","issue":{"url":"https://api.github.com/repos/pnp/pnpjs/issues/120","repository_url":"https://api.github.com/repos/pnp/pnpjs","labels_url":"https://api.github.com/repos/pnp/pnpjs/issues/120/labels{/name}","comments_url":"https://api.github.com/repos/pnp/pnpjs/issues/120/comments","events_url":"https://api.github.com/repos/pnp/pnpjs/issues/120/events","html_url":"https://github.com/pnp/pnpjs/issues/120","id":328927771,"node_id":"MDU6SXNzdWUzMjg5Mjc3NzE=","number":120,"title":"Using PnP to query SharePoint Online from Office Addin (Word)","user":{"login":"pabmardo","id":29203116,"node_id":"MDQ6VXNlcjI5MjAzMTE2","avatar_url":"https://avatars1.githubusercontent.com/u/29203116?v=4","gravatar_id":"","url":"https://api.github.com/users/pabmardo","html_url":"https://github.com/pabmardo","followers_url":"https://api.github.com/users/pabmardo/followers","following_url":"https://api.github.com/users/pabmardo/following{/other_user}","gists_url":"https://api.github.com/users/pabmardo/gists{/gist_id}","starred_url":"https://api.github.com/users/pabmardo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pabmardo/subscriptions","organizations_url":"https://api.github.com/users/pabmardo/orgs","repos_url":"https://api.github.com/users/pabmardo/repos","events_url":"https://api.github.com/users/pabmardo/events{/privacy}","received_events_url":"https://api.github.com/users/pabmardo/received_events","type":"User","site_admin":false},"labels":[{"id":851930666,"node_id":"MDU6TGFiZWw4NTE5MzA2NjY=","url":"https://api.github.com/repos/pnp/pnpjs/labels/area:%20code","name":"area: code","color":"eaeaea","default":false},{"id":802873610,"node_id":"MDU6TGFiZWw4MDI4NzM2MTA=","url":"https://api.github.com/repos/pnp/pnpjs/labels/status:%20investigate","name":"status: investigate","color":"c2e0c6","default":false},{"id":802864291,"node_id":"MDU6TGFiZWw4MDI4NjQyOTE=","url":"https://api.github.com/repos/pnp/pnpjs/labels/type:%20question","name":"type: question","color":"84b6eb","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-06-04T06:45:50Z","updated_at":"2018-06-04T17:59:45Z","closed_at":null,"author_association":"NONE","body":"### Category\r\n- [ ] Enhancement\r\n- [ ] Bug\r\n- [* ] Question\r\n- [ ] Documentation gap/issue\r\n\r\n### Version\r\n[ 1.1.0 ]\r\n### Expected / Desired Behavior / Question\r\nMy goal is to render a Word Document with HTML content got from SharePoint Online HTML (rich text fields)... as office for web apps is not supporting Altchuncks the only way I manage to get the results I need is with a Word Addin, so I would like to query SharePoint Online from Word addin, I have proper word addin code and proper PnP querying code to SharePoint Online (as tested from a CommandSet in SharePoint Framework), but I can't make it work from Word Addin as its always complaining about Crossdomain request.\r\nI have tried to configure the SPRequestExecutorClient() as it should be done from SharePoint Addin but nothing seems to work.\r\n\r\n¨Error: SP.RequestExecutor is undefined.  Load the SP.RequestExecutor.js library (/_layouts/15/SP.RequestExecutor.js) before loading the PnP JS Core library.¨\r\n\r\nI'd need some example, help, or someone pointing out the right approach. Thanks\r\n\r\n### Observed Behavior\r\nCan debug but always get either the crossdomain 403 error or the preflight: Response to preflight request doesn't pass access control check: The value of the 'Access-Control-Allow-Origin' header in the response must not be the wildcard '*' when the request's credentials mode is 'include' if querying with REST\r\n\r\n\r\n`\r\nimport {sp, SPRequestExecutorClient} from \"@pnp/sp-addinhelpers\";\r\n\r\n// at document ready\r\nsp.setup({\r\n          sp: {\r\n              fetchClientFactory: () => {\r\n                  return new SPRequestExecutorClient();\r\n              }\r\n          }\r\n        });\r\n        console.log('endInit');\r\n\r\n//inside the  action I want       \r\nsp.crossDomainWeb(\"https://localhost:3000\", \"https://mytenant2018.sharepoint.com/\").getList(\"Lists/tests\").items.select(...notesFieldNames).filter(_filter).top(500).orderBy(\"ID\", false).get()//.get<Array<any>>()\r\n            .then((notes: any) => {  \r\n              console.log(\"Entering here 1\");\r\n                  OfficeHelpers.Dialog.call('done!');            \r\n                  _text2BeInserted=\"\";\r\n                  notes.forEach((note: any) => {\r\n                    let _newNote : NotesContent = new NotesContent();\r\n                    _newNote.Order = note.ID.toString();\r\n                    _newNote.Title = note.Title !== undefined && note.Title !== null ? note.Title : \"No Title Found\";\r\n                    _newNote.Content = note.Body !== undefined && note.Body !== null ? note.Body : \"No Body for the Note\";\r\n\r\n                    _contentForFile.push(_newNote);\r\n                    console.log('concatenating 1');\r\n                    _text2BeInserted += _newNote.Title;\r\n                    _text2BeInserted += _newNote.Content;\r\n                    //_contentForFile += item.ReportBody !== undefined && item.ReportBody !== null ? item.ReportBody : \"\";\r\n                  });\r\n            })\r\n            .catch((error: any): void => {\r\n              // this.safeLog(error);\r\n              console.log('it failed');\r\n              console.log(error);\r\n            });`\r\n\r\n### Steps to Reproduce\r\nInstalled the PNP and PNPhelpers but not working.\r\n"},"comment":{"url":"https://api.github.com/repos/pnp/pnpjs/issues/comments/394444291","html_url":"https://github.com/pnp/pnpjs/issues/120#issuecomment-394444291","issue_url":"https://api.github.com/repos/pnp/pnpjs/issues/120","id":394444291,"node_id":"MDEyOklzc3VlQ29tbWVudDM5NDQ0NDI5MQ==","user":{"login":"patrick-rodgers","id":13154702,"node_id":"MDQ6VXNlcjEzMTU0NzAy","avatar_url":"https://avatars3.githubusercontent.com/u/13154702?v=4","gravatar_id":"","url":"https://api.github.com/users/patrick-rodgers","html_url":"https://github.com/patrick-rodgers","followers_url":"https://api.github.com/users/patrick-rodgers/followers","following_url":"https://api.github.com/users/patrick-rodgers/following{/other_user}","gists_url":"https://api.github.com/users/patrick-rodgers/gists{/gist_id}","starred_url":"https://api.github.com/users/patrick-rodgers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/patrick-rodgers/subscriptions","organizations_url":"https://api.github.com/users/patrick-rodgers/orgs","repos_url":"https://api.github.com/users/patrick-rodgers/repos","events_url":"https://api.github.com/users/patrick-rodgers/events{/privacy}","received_events_url":"https://api.github.com/users/patrick-rodgers/received_events","type":"User","site_admin":false},"created_at":"2018-06-04T17:59:45Z","updated_at":"2018-06-04T17:59:45Z","author_association":"MEMBER","body":"This isn't something I've tried before, so don't have an example ready to provide. I'll try and get some time to try it out, but can't promise a quick response as I just got back from being OOF for a week and am catching up. Is your add-in hosted in nodejs or are you trying to serve a client page? Since you are really making the request from your hosted add-in page it will get blocked by CORS. And the cross domain stuff is meant (as far as I know) to work with SP add-ins and there isn't special support for office add-ins. But I haven't tried so maybe there is a way.\r\n\r\nCan you do the request as app only permissions on the server side - is that an option for you?"}}
{"actor":{"display_login":"patrick-rodgers"}}