How to send PDF and STEP file to supplier (not with email)?

Im looking for alternative ways to send the PDF of a drawing and the STEP file to a supplier to make a part.
We currently use an external sharepoint site but this is very manual process of loading the file to the suppliers page on the site.

Wanted to see how others are sending the data, other than emailing the PDF/STEP.

How about a function that uploads a file to SharePoint ? I am working on something slightly different and I have the upload-to-sharepoint piece working. Below is the code from it - if you know your way around functions, you can easily tweak it to work for what you need.

The Function needs references to Microsoft.SharePoint.Client.dll and Microsoft.SharePoint.Client.Runtime.dll along with usings:
using System.Security;
using Microsoft.SharePoint.Client;

  // local path in Epicor appserver for the file that needs uploaded
  string txtLogPath = @"C:\EpicorData\Tests\FileName.csv"; 
  // sharepoint site URL 
  string spURL = "https://yourdomain.sharepoint.com/sites/yoursite";
  // sharepoint libarry URL (destination for the local file)
  string spLibrary = "YourDocuentLibrary";
  // user and password to connect to Sharepoint
  string spUser = "user@domain.com";
  string spPass = "yourpasswordhere";


  // upload the file to sharepoint 
  using (ClientContext clientContext = new ClientContext(spURL))
  {
    // connection
    SecureString password = new SecureString();
    foreach (char c in spPass.ToCharArray()) password.AppendChar(c);
    clientContext.Credentials = new SharePointOnlineCredentials(spUser, password);
    
    // open filestream using file created previously
    using (FileStream fs = new FileStream(txtLogPath, FileMode.Open))
    {
      // upload file to sharepoint (using ContentStream for large files)
      Web web = clientContext.Web;
      FileCreationInformation newFile = new FileCreationInformation
      {
        ContentStream = fs,
        Url = Path.GetFileName(txtLogPath),
        Overwrite = true
      };
      List docs = web.Lists.GetByTitle(spLibrary);
      Microsoft.SharePoint.Client.File uploadFile = docs.RootFolder.Files.Add(newFile);
      clientContext.Load(uploadFile);
      clientContext.ExecuteQuery();
    }
  
  }

2 Likes

Two potential small improvements.

  • To avoid needing the SharePoint .DLLs, use the MS Graph call which is REST
  • Use Token Authentication to avoid having credentials hard-coded in the code - or at least use a secrets manager to retrieve anything that might need to be changed quickly if compromised.

Great, I was worried about that too. I’ll give that a try.

So your function is taking a local file on your machine and loading it to sharepoint?

Yes, that’s what it does. But it is not saved locally on my machine, it is saved on the Epicor app server (where the function actually runs). The var txtLogPath I have there is a path on the app server.

could it move the file from a central sharepoint folder to a folder that is named the supplier ID of the PO that is generated and fire the function at the time of po approval?

SharePoint people would argue that one would use metadata to indicate the status of the document. Moving things from one virtual folder to another is mimicking what we did in a network share - which is what we used to do in the physical world.

One of the strengths of ECM and SharePoint is that one can create views based on document properties (show me all open POs, POs in the last x days, my POs, etc.), so there’s no need to move files around. These properties are often logged so we also know when and how many times a value has changed and by whom.

1 Like

we just purchased ECM and are doing the AP project now.
Are you saying I could use ECM to do this process of sharing ?

I’ve been away from DocStar, er, ECM a bit but I’m sure @gpayne, @MikeGross, @vleveris, @Banderson, or @swilliasc111 might know the REST import functionality of ECM. I only used the Import Client locally.

Is your ECM on-prem or hosted? Hosted is easier to share with suppliers I would imagine since SP online is, well, already online.

From your original post, I take it that we are talking about a PO process that submits the PO to the Supplier and you’d like a PDF/STEP file to accompany it. That is what APR and ECM are really good at, assuming the files are already in ECM. The workflow in APR can send the PO as a PDF, and attach files from ECM. Sounds like your answer.

Also, like Mark said, folder structures are irrelevant to ECM, but are good for human brains. If your files are created with the correct name - like the PO# - and stored in a big ol’ bucket inside ECM - they can be easily attached in APR without any other info.

If the files are not/cannot be in ECM, then you could use the same APR workflow to send the PO as a PDF and include HTTPS links to the files that are located in a ‘shared’ space. The trick could be how to dynamically create those links to where the files were previously stored. Coming from a different direction, using an integration platform (like Workato or other API Saas) can including reaching out to ECM and other storage locations to get things sent, but requires a different setup and security considerations.

I guess it comes down to how you wish to ‘share’. Sending a link to a semi-secure site like a SharePoint ‘folder’, or and FTP site, or Google drive - or directly sending the file(s).

Between REST, ECM, APR, Sharepoint, and integration platforms like Workato, there is defintely a way.

1 Like

we are on prem for ECM. IDC will be SAAS

this is how we are currently doing it. We have a folder for each supplier and only the members of that company can access their folder. As new parts/revs are created, the new part STEP file is added to the folder of the supplier that will be supplying the part.
all this is manual process, I’m thinking though how to build in some automation / error proofing.

What is the automation you’re looking for?

ECM on prem is sort of a gotcha in this scenario. SAFE-HARBOR and all, there is a feature coming in the next release (did it already drop?) that allows for 3rd party access to ECM. Problem is, ECM needs to be internet facing/accessible if anyone form the outside is going to have access of any kind.

The creation of the STEP file is manual. I’m assuming the drawing PDF is as well. Where’s the automation point? And do you need to do soemthing other than SharePoint?

If it’s moving the files to the right location in SharePoint, then I’d use the MS Graph API and some workflow tool like MS Power Automate ¶. Have a headless email box to send those files to, scrape the info you need from the email, and it’ll file those attachments for you. It could also send notification and/or URLs to the Supplier’s folks listed as accessing the folder location. Pretty sure all that will work in PA.

If it’s simply sending notification that those files exist after they’ve been manually stored in SP, then PA will also do that.

This is the part im looking to automate if possible. I will look into PA as a possible solution.

Sorry - I should’ve asked that question first… PA was just a suggestion, but it’s wide open if that’s what you want to automate. Since you have a MS Tennant, you can use the MS Graph interface or a number of options from Microsoft or other companies like Workato, Boomi, etc.

2 Likes

Remember, with SP, you really don’t need to move anything to share it. If you have a Team with your supplier, the files in there are stored in SharePoint behind the scenes. You can then invite that supplier to the team, and they’ll have access to the document library as well as a chat area. You can create a private channel to discuss items about the supplier without them seeing it. Microsoft handles the login and you control access. Not sure what the ECM security model is yet but, in the meantime, it may be worth a look.

1 Like