none
Remove an author from 50Gb of Office documents RRS feed

  • Question

  • Hi all,

    I'm looking for a Powershell script that could remove one specific author from the author list of thousands of documents...

    I found some powershell scripts to list properties, to remove personnal informations, but here I have to remove one author from the list of authors... looks like difficult.

    Any idea how I could do that?

    Thanks,

    François

    Friday, August 4, 2017 9:40 AM

All replies

  • Hi,
    I'd like to search how-to. What kind of Office documents are your target?  Word, Excel, other?
    I'd like to know all of extensions of your target.

    Ashidacchi

    Friday, August 4, 2017 10:26 AM
  • Well any Office document types (Word, Excel, PowerPoint) and even old format (doc, xls, ...)

    I'd prefere not to run COM interop to do the job.

    Friday, August 4, 2017 11:42 AM
  • Hi frenchybe,

    For automation of Office documents not with COM interop dll, I suggest you use OpenXML to do this job. You could call PackageProperties.Creator to get/modified the author information, return value is a string and if there are multiple authors, they will be split with a ";" character.

    Here is the example to get the author information. You need to tell which type the file is and then choose corresponding method.

    Word

                using (WordprocessingDocument doc =

                 WordprocessingDocument.Open(filepath, true))

                {

                    MessageBox.Show(doc.PackageProperties.Creator.ToString());

                    doc.Close();

                }

    Excel

                using (SpreadsheetDocument myWorkbook = SpreadsheetDocument.Open(filepath, true))

                {

                    MessageBox.Show(myWorkbook.PackageProperties.Creator.ToString());

                    myWorkbook.Close();

                }

    PPT

                              using (PresentationDocument pptPre = PresentationDocument.Open(filepath, true))

                {

                    MessageBox.Show(pptPre.PackageProperties.Creator.ToString());

                    pptPre.Close();

                }

    Best Regards,

    Terry

    Monday, August 7, 2017 6:31 AM