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
Hello Jakub, I need help for uploading files to my sharepoint site.
i did everything as you say in your docs, but when i try to upload i get this error.
Getting error as:
my code
`$file = $request->file('file');
$newFileName = Helpers::reformatFileName($file->getClientOriginalName());
$allowedMimeTypes = ['image/png', 'image/jpg', 'image/jpeg', 'application/pdf', 'application/docx'];
if (!in_array($file->getMimeType(), $allowedMimeTypes)) {
return "File type not allowed.";
}
$filePath = 'submittal-files/' . $request->input('id');
$site_url = 'https://xxxxx.sharepoint.com';
$library = 'Documents'; // Replace with your SharePoint library name
$folder = 'xxxxx'; // Replace with your SharePoint folder name
//sharepoint
$app_id = 'xxxxxxx';
$app_secret = 'xxxxxxx';
$redirect_uri = 'https://url';
$client = $this->sharepointClient->makeClient( $site_url, $app_id, $app_secret, $redirect_uri);
$url = $client->getUserConsentUri();
$auth_code = 'PAQABAAEAAAAtyolDObpQQ5VtlI4uGjEPSxAdxpjJBhHs_aK2NwCVnK5CHKtN_OzqVup0hPEQKp5k_3xo9gNhBXUBp7ErdsNvTwDF1erTf5iGtivKATZCkRciqXqOK71bEwdgB';
$refreshToken = $client->getRefreshTokenFromAuthCode($auth_code);
// Upload the file to SharePoint
$upload_result = $client->uploadFile(
$refreshToken,
'https://mysite.sharepoint.com/Shared%20Documents/Forms/AllItems.aspx?viewpath=%2FShared%20Documents%2FForms%2FAllItems%2Easpx&id=%2FShared%20Documents%2FCQ%20De&viewid=75380876%2D96c8%2D4d78%2D86e6%2Ddb6f24b940f9',
$filePath,
\Storage::disk('local')->readStream($filePath));`
here i created app id & secret in both sharepoint and azure.
Whether should i mention azure endpoint.
if need where should i mention it.
please help me out from this.
The text was updated successfully, but these errors were encountered:
Hello Jakub, I need help for uploading files to my sharepoint site.
i did everything as you say in your docs, but when i try to upload i get this error.
Getting error as:
Client error: `POST https://xxxxx.sharepoint.com/_api/web/GetFolderByServerRelativeUrl('https://xxxxxx.sharepoint.com/SitePages/Home.aspx?
my code
`$file = $request->file('file');
$newFileName = Helpers::reformatFileName($file->getClientOriginalName());
$allowedMimeTypes = ['image/png', 'image/jpg', 'image/jpeg', 'application/pdf', 'application/docx'];
if (!in_array($file->getMimeType(), $allowedMimeTypes)) {
return "File type not allowed.";
}
$filePath = 'submittal-files/' . $request->input('id');
$site_url = 'https://xxxxx.sharepoint.com';
The text was updated successfully, but these errors were encountered: