question

SadowskiCraig-9082 avatar image
0 Votes"
SadowskiCraig-9082 asked richxyz1 edited

Can SSRS automatically send a file to a sharepoint site on a daily basis?

Currently, I can get SSRS to generate a file with data to a fileshare but cannot figure out how to put it in sharepoint instead.

Can SSRS automatically send a file to a sharepoint site on a daily basis?

sql-server-reporting-services
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

ZoeHui-MSFT avatar image
0 Votes"
ZoeHui-MSFT answered ZoeHui-MSFT commented

Hi @SadowskiCraig-9082,

As I know there is no feature available to upload the file directly to sharepoint site.

One possible methods is to subscription SSRS report and save to shared folder. file-share-delivery-in-reporting-services .

You may save the file to a new created local file. Then sync it to one drive folder or upload it along with some powershell script to do the automation.

Check this blog which shows how to do the file upload automatically : SharePoint Online Automation - O365 - Upload Your Files Remotely Using PowerShell To SPO Document Library

Regards,

Zoe


If the answer is helpful, please click "Accept Answer" and upvote it.

Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.
Hot issues October

· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

If you have any updates, don't forget to tell us.

0 Votes 0 ·
richxyz1 avatar image
0 Votes"
richxyz1 answered richxyz1 edited

We wrote and scheduled a console app to create a csv file and then upload it to SharePoint using the following code:

//Set up variables
string[] destinationUrl = { "https://myclouldurl.sharepoint.com/sites/po/services/LKP/Enviro/Weekly/" + fileName };
CopyWebService.CopyResult cResult1 = new CopyWebService.CopyResult();
CopyWebService.CopyResult cResult2 = new CopyWebService.CopyResult();
CopyWebService.CopyResult[] cResultArray = { cResult1, cResult2 };
CopyWebService.FieldInformation fFiledInfo = new CopyWebService.FieldInformation();
CopyWebService.FieldInformation[] fFiledInfoArray = { fFiledInfo };
//Reading the document contents in to stream
FileStream strm = new FileStream(sourceUrl, FileMode.Open, FileAccess.Read);
byte[] fileContents = new Byte[strm.Length];
byte[] r = new Byte[strm.Length];
int ia = strm.Read(fileContents, 0, Convert.ToInt32(strm.Length));
strm.Close();

//Copy the document from SourceUrl to destinationUrl with metadatas
uint copyresult = copyService.CopyIntoItems(sourceUrl, destinationUrl, fFiledInfoArray, fileContents, out cResultArray);

if (copyresult == 0)
Console.WriteLine("Document uploaded successfully from " + sourceUrl + " to " + destinationUrl[0]);
else
Console.WriteLine("Document gets failed on uploading..");

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.