It seems like a lot of third party tools do this but obviously they don't make it known. I've used quite a few open source tools for bulk file upload from file/network shares into SharePoint but it seems like most of them don't quite capture the user information when you're talking about uploading FROM these shares (and not from library to library within SharePoint).

The SPFileCollection.Add method contains an pretty appropriate overload:

SPFileCollection.Add method (String, Stream, SPUser, SPUser, DateTime, DateTime)

public SPFile Add(
string urlOfFile,
Stream file,
SPUser createdBy,
SPUser modifiedBy,
DateTime timeCreated,
DateTime timeLastModified)

Now, I know you can get timeCreated and timeLastModified by referencing properties of an instance of FileInfo. And I know that you can "sort of" get a created-by value by looking at the security info of a file and getting the owner:

string user = System.IO.File.GetAccessControl(path).GetOwner(typeof(System.Security.Principal.NTAccount)).ToString();

The reason I ask is because I suspect, after looking at SPFileZilla2013's source, that it uses this overload. In that project's code it gets the timeCreated and LastWriteTime from an instance of FileInfo as previously mentioned but after combing through it some more I'm not 100% sure on what values it uses for both instances of SPUser and my best guess is that it gets the principal for the user account supplied to it in the GUI for connecting to your site.

Has anyone run across a method or know of a way they can share where you could get the most accurate values of the created by and last modified by user values from the file system to use in this method? Third party tools seem to do it (ShareGate, Metalogix, etc) so there has to be a way.

1 Answer 1


For Office Documents you can use OpemXML to access the PackageProperties and retrieve both Creator and ModifiedBy. For Non-Office documents you are out of luck unless you have an ifilter that can access specific properties on the file type.

  • This would be an iFilter called/used in C# right, not something installed in SharePoint 2013? Feb 28, 2017 at 21:47
  • Yes. However plain text and many other file types have no additional metadata so not even an ifilter would make any difference.
    – Bunzab
    Mar 1, 2017 at 18:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.