Is upload of lib folder still needed when deploying web-part (SharePoint integration)?

Product: WebViewer/BIM

Product Version:

Please give a brief summary of your issue:
First of all I want to understand if it is still needed to upload the folder for each site when you are deploying the web part/ extension and so on or I can leave it inside the web part project, just bundle it and it will work.

I mean this steps:
3. In the Document Library of your SharePoint site, create a “Webviewer” folder and create another child folder “js” inside the “Webviewer” folder.
4. Upload the lib folder extracted from the WebViewer.zip to the js folder.
The webviewer lib folder should now be available from the url: https://.sharepoint.com/sites//Shared Documents/Webviewer/js/lib.

Second question is if I want to deploy web part for example how can I make it easily usable on different tenants and sites without using .env file ? Cause I’m not completely understand how to make it.

1 Like

Thank you for posting your question to our forum. We will provide you with an update as soon as possible.

1 Like

Hello, for how long do I need wait for a respond ? Thanks for the answer !

1 Like

Hello Skygus,

We apologize for the delay. We are still currently investigating your issue. Thank you for your patience.

Best Regards,
Jacob Romano Carlsen
Web Development Support Engineer
Apryse Software Inc.

1 Like

Hello Skygus,

Bundling the project with the lib folder inside should be sufficient.

If you are bundling it in an app and not including the lib folder the files, then
https://.sharepoint.com/sites//Shared Documents/Webviewer/js/lib
aka the domain that is hosting WebViewer wont have the files.

Best Regards,
Jacob Romano Carlsen
Web Development Support Engineer
Apryse Software Inc.

1 Like

As alternative can I place it in azure to make it accessible for multiple site collections?

1 Like

Hello Skygus,

Yes, that works as well.
You can find more information regarding remote lib here: Apryse Documentation | Documentation

Best Regards,
Jacob Romano Carlsen
Web Development Support Engineer
Apryse Software Inc.

1 Like

Also wanted to clarify what is a correct way, to provide config.js file ? Cause for now I receive problem that viewer is on a different domain when make it through azure cdn, and it gives me suggestion to create config.js and put code in there. I tried to put it as a separate blob in my azure storage, but after I provide config field to Webviewer class, after “then” “instance” is undefined

1 Like

Hello Skygus,

Since you have the path option specified on another domain, you will need to edit the lib/ui/configorigin.txt file to whitelist your app’s domain(s).
See this link for more info: Apryse Documentation | Documentation

It is also worth noting that we encourage config files to first be added within the project files and passed in as a relative URL, relative to the HTML file.

1 Like

@jromanocarlsen Also wanted to clarify another moment. Here you mention the possibility to separate lib and store only core in some cdn for example, but ui will still be on the same domen as iframe. How can I make this possible ? Cause it is not valid to pass the full url in uiPath parameter. The app will make a calls in such format:
https://myblob.blob.core.windows.net/webviewer-library/lib/https://mytenant.sharepoint.com/sites/MySite/PDFTronAssets/WebViewer/js/lib/ui

1 Like

Hello Skygus,

If I understand correctly, this is your current issue:

  • You would like to follow this guide to move your lib/core files on another domain
  • The UI will remain will not be moved and will exist in the project’s current domain
  • You are specifically concerned with the uiPath option in the WebViewer constructor

Let me know if I missed anything or if I misunderstood.

I noticed that your current uiPath does not have a .aspx extension.
As mentioned in the sample project we provide, uiPath must lead to the entry point of the webviewer ui, and for sharepoint it would have a .aspx extension.

Was the ‘./ui/index.aspx’ value not working for you?

Best Regards,
Jacob Romano Carlsen
Web Development Support Engineer
Apryse Software Inc.

1 Like

I’ve looked for both approaches:

  • Move both ui and core folder to Azure storage
  • Move only core library and leave ui in sharepoint.
    Right now I understand that I need the first approach (I mean * Move both ui and core folder to Azure storage). But I have problems in implementing it.
    When i move both folder to Azure storage I do following things:
  1. I add in configorigin.txt the name of domain where my sharepoint web app (PDF Viewer) will run:
    https://domainname.sharepoint.com
  2. I add config.js file in the same folder where index.aspx file (i mean index.aspx file that is inside ui folder, that is stored in my azure storage account)
  3. In cofig file i provide following:
    Core.setWorkerPath(‘https://mycdnforviewer.blob.core.windows.net/webviewer-library/lib/core’);
    Core.setLocalWorkerPath(‘https://domainname.sharepoint.com/sites/ProjektModulPlanmanagement/PDFTronAssets/WebViewer’, false);
    (https://domainname.sharepoint.com/sites/ProjektModulPlanmanagement/PDFTronAssets/WebViewer by this path i added copies of Worker.js and CORSWorker.js)
  4. I provide the following code in WebViewer constructor
    image
  5. After running code the form of webviewer itself is successfully loaded, but i get the error

and if try to debug the instance variable is undefined
WebViewer({

  licenseKey:                                                                 `demo:1699282811419:7cc754c60300000000f53f81facbb717afb8a86fbd5367a`,
  path: `https://mycdnforviewer.blob.core.windows.net/webviewer-library/lib`,
  config: `https://mycdnforviewer.blob.core.windows.net/webviewer-library/lib/ui/config.js`,
  enableAzureWorkaround: true,
  uiPath: './ui/index.aspx',
}, this.domElement)
  .then(async instance => {
    this._graphConsumer = new GraphConsumer(this.context);
    const currentUser: ISiteUserInfo = await this._sp.web.currentUser();
    const allUsers: ISiteUserInfo[] = await this._sp.web.siteUsers();
    const userData: UI.MentionsManager.UserData[] = allUsers.map(s =>
      ({ value: s.LoginName, email: s.Email }));

    instance.UI.mentions.setUserData(userData); //here comes the error from console cause instance is undefined
1 Like

Hello Skygus,

Thank you for the clarification.

Looking at the config option in your WebViewer constructor, you mentioned it is store in your azure storage account.

Usually that option is passed in a relative url, relative to the index.html file (same folder as where your constructor is). Would you be able to move it there and use a relative url in your WebViewer construction options and see if that works?

Best Regards,
Jacob Romano Carlsen
Web Development Support Engineer
Apryse Software Inc.

1 Like