Sharepoint 2013 onpremise document management

susmitha 266 Reputation points
2021-11-04T10:49:53.277+00:00

Hi,

We have the data coming from 3rd party into our Sharepoint 2013 environment using a library option incoming email settings.

So daily in the morning we used to get a zip folder, where as we extract and upload it again into a document library. We use this link as reference in content editor webpart.

So, is there a way that unzips the file coming using incoming email configuration, so that file in the respective zip folder gets extracted and added in a different library or the same library?

or If someone can suggest me a way to get file into Sharepoint unlike incoming email settings option? 3rd party tool puts the file into a location and Sharepoint picks it up and uploads into a document library ?

Regards,
Susmitha.

Microsoft 365 and Office SharePoint Server For business
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Yi Lu_MSFT 17,611 Reputation points
    2021-11-05T09:19:15.947+00:00

    Hi @susmitha
    Out-of-the-box this is not possible on SharePoint 2013.

    As to 3rd party, it is not supported in Q&A forum, thans for your understanding.


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    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.

    0 comments No comments

  2. sadomovalex 3,636 Reputation points
    2021-11-09T15:03:46.143+00:00

    you can implement ItemAdded event receiver which will check incoming files and unzip them automatically e.g. like shown here: Programmatically add extracted zip file into document library

    public override void ItemAdded(SPItemEventProperties properties)
            {
                ZipFile zf = null;
                try
                {
                    SPWeb oWeb= properties.OpenWeb();                       
                oWeb.AllowUnsafeUpdates = true;
                            SPList objlist = oWeb.Lists[properties.ListTitle];
                            SPListItem currentListItem = properties.ListItem;
                            SPFile sourceFile = properties.ListItem.File;
                            string tempdir = "";
    
                            using (Stream stream = sourceFile.OpenBinaryStream())
                            {
                                zf = new ZipFile(stream);
                                foreach (ZipEntry zipEntry in zf)
                                {
                                    if (!zipEntry.IsFile)
                                    {
                                        string foldername = zipEntry.Name;
                                        tempdir = CreateFolder(oWeb, foldername);
                                        continue;                                 // Ignore directories
                                    }
                                    else
                                    {
                                        String entryFileName = zipEntry.Name;
                                        entryFileName = Path.GetFileName(entryFileName);
                                        SPDocumentLibrary destLib = (SPDocumentLibrary)properties.ListItem.Web.Lists["test"];
                                        string foldrptath = tempdir;
                                        SPFolder folder =oWeb.Getfolder[tempdir];
                                        SPFile spfile = folder.Files.Add(entryFileName, stream, true);
                                    }
                                }
                                stream.Close();
                            }
                            oWeb.AllowUnsafeUpdates = false;
    
                }
                catch (Exception ex)
                {
                }
                finally
                {
                    if (zf != null)
                    {
                        zf.IsStreamOwner = true; 
                        zf.Close();
    
                    }
                }
            }
    
            private static string CreateFolder(SPWeb MyWeb, string txtFolder)
            {
    
                SPDocumentLibrary docLibrary = (SPDocumentLibrary)MyWeb.Lists["test"];
    
                SPFolderCollection MyFolders = MyWeb.Folders;
    
                String Dirname = docLibrary + "/" + txtFolder;
    
                MyFolders.Add(Dirname);
    
                docLibrary.Update();
    
                return (Dirname);
            }
    

    (consider using this code as idea sample. I didn't try it by myself - but it is good to start with).


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.