You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
`
import { IInputs, IOutputs } from "./generated/ManifestTypes";
import type { MSALOptions } from "@pnp/msaljsclient";
import { spfi, SPBrowser } from "@pnp/sp";
import { MSAL, getMSAL } from "@pnp/msaljsclient";
import "@pnp/sp/webs";
import "@pnp/sp/lists";
import "@pnp/sp/site-users/web";
export class pcfspolargeupload implements ComponentFramework.StandardControl<IInputs, IOutputs> {
constructor()
{
}
public async init(context: ComponentFramework.Context, notifyOutputChanged: () => void, state: ComponentFramework.Dictionary, container:HTMLDivElement): Promise
{
let _notifyOutputChanged: () => void
let _context: ComponentFramework.Context
let _spContext: any
const options: MSALOptions = {
configuration: {
auth: {
authority: "https://login.microsoftonline.com/[TenantID]/",
clientId: "[AppID]",
},
cache: {
claimsBasedCachingEnabled: true // in order to avoid network call to refresh a token every time claims are requested
}
},
authParams: {
forceRefresh: false,
scopes: ["https://tenant.sharepoint.com/.default"],
}
};
I’m using PnPJs to create a PCF control for uploading large files to SharePoint within a canvas app. The code below is working while editing the canvas app, along with the redirection URI : https://authoring.eu-il109.gateway.prod.island.powerapps.com/v3.24095.15.310953622/embed/
`
import { IInputs, IOutputs } from "./generated/ManifestTypes";
import type { MSALOptions } from "@pnp/msaljsclient";
import { spfi, SPBrowser } from "@pnp/sp";
import { MSAL, getMSAL } from "@pnp/msaljsclient";
import "@pnp/sp/webs";
import "@pnp/sp/lists";
import "@pnp/sp/site-users/web";
export class pcfspolargeupload implements ComponentFramework.StandardControl<IInputs, IOutputs> {
constructor()
{
}
public async init(context: ComponentFramework.Context, notifyOutputChanged: () => void, state: ComponentFramework.Dictionary, container:HTMLDivElement): Promise
{
let _notifyOutputChanged: () => void
let _context: ComponentFramework.Context
let _spContext: any
const options: MSALOptions = {
configuration: {
auth: {
authority: "https://login.microsoftonline.com/[TenantID]/",
clientId: "[AppID]",
},
cache: {
claimsBasedCachingEnabled: true // in order to avoid network call to refresh a token every time claims are requested
}
},
authParams: {
forceRefresh: false,
scopes: ["https://tenant.sharepoint.com/.default"],
}
};
const sp = spfi("https://tenant.sharepoint.com/").using(SPBrowser(), MSAL(options));
const user = await sp.web.currentUser();
// For logout later on
const msalInstance = getMSAL();
const currentAccount = msalInstance.getActiveAccount();
const list = sp.web.lists.getByTitle("Documents");
// we can use this 'list' variable to run more queries on the list:
const r = await list.select("Id")();
// log the list Id to console
console.log(r.Id);
container.appendChild(document.createTextNode(r.Id));
}
public updateView(context: ComponentFramework.Context): void
{
}
public getOutputs(): IOutputs
{
return {};
}
public destroy(): void
{
}
}`
Question/Request
When I publish the app and access it, the redirection URI changes to: https://runtime-app.powerplatform.com/publishedapp/e/default-cc83b6ac-505f-4efc-a552-a2c7bfa6d7e3/preloadindex/V1. The popup doesn’t close, and I’m unsure what I’m doing wrong. What steps should I take to get PnPJs working with my AAD app to upload large files to SharePoint via PCF control in Canvas app?
The text was updated successfully, but these errors were encountered: