jackjohnson44
asked on
c# how do I get who created a word doc?
I want to find out who created a word doc?
private void GetFileInformation(Documen t Doc)
{
//how do I get created by
private void GetFileInformation(Documen
{
//how do I get created by
http://www.java2s.com/Tutorial/CSharp/0520__Windows/ModifyDocumentProperties.htm
ASKER
I already have the document being passed in, isn't there a way to do it without making another instance of word? This will take way too long. Isn't there a way to get it from the doc?
please see this..
private void GetFileInformation(Document Doc)
{
object BuiltInProps;
BuiltInProps = Doc.BuiltInDocumentProperties;
Type TypeBuiltingProp = BuiltInProps.GetType();
string Prop = "Author";
string AuthorName;
object AuthorProp = TypeBuiltingProp.InvokeMember("item", BindingFlags.Default | BindingFlags.GetProperty, null, BuiltInProps, new Object[] { Prop });
Type TypeAuthorProp = AuthorProp.GetType();
AuthorName = TypeAuthorProp.InvokeMember("Value", BindingFlags.Default | BindingFlags.GetProperty, null, AuthorProp, new Object[] { }).ToString();
Console.WriteLine("{0}", AuthorName);
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.