locked
ModifiedBy in the API Doesn't match ModifiedBy in UI RRS feed

  • Question

  • Hey,

    So I'm writing a console application that copies Documents from one library to another. It's important to the client that the "ModifiedBy" and "CreatedBy" columns match eachother in the source and destination. However while it may say that the system account was the last user to modify a particular document, when I access the value from the API it's listing a different user. Here's a sample of code:

    List<SPFileVersion> Versions = SourceFile.Versions.Cast<SPFileVersion>().OrderBy(ver => ver.VersionLabel).ToList();
    foreach (SPFileVersion version in Versions)
    {
        SPUser Creator = version.Properties["vti_author"];            
        SPUser Modifier = version.Properties["vti_modifiedby"];
        DateTime Creation = version.File.TimeCreated;
        DateTime Modification = (DateTime)version.Properties["vti_timelastmodified"];
    CurrFolder.Files.Add(SourceFile.Name, version.OpenBinary(), Creator, Modifier, Creation, Modification);
    }
    Any ideas as to why the API and the UI are showing different values?
    Tuesday, July 2, 2013 7:25 PM

Answers

  • To be clear, are you saying that once you have copied the file, the copy appears in the UI to have been created by the "System Account", but when you retrieve the same file copy with the API it has a different user name? Which fields -- Creator and Modifier?

    What account are you logged into as when you run the console application? Is this account the farm account or web application pool account? Have you tried using an administrative account that has no other roles in the farm?


    Tuesday, July 2, 2013 7:50 PM