DKS
DKS

Reputation: 1

PowerPoint + VSTO dynamically changing author of comment

I want to dynamically add the author's name for each comment in PowerPoint with an office 365 subscription. I have tried the below code and it's working fine with PowerPoint 2016. But when I tried to add a comment in PowerPoint with office 365 login, it always add a comment with login user

string timestamp = System.DateTime.Now.ToString("yyyyMMddHHmmssFFF") + "_" + subcategoryId;
                Microsoft.Office.Interop.PowerPoint.TextRange rng = Globals.ThisAddIn.Application.ActiveWindow.Selection.TextRange;
                Microsoft.Office.Interop.PowerPoint.Comment comment = Globals.ThisAddIn.Application.ActiveWindow.Selection.SlideRange.Comments.Add(900, 600, timestamp, "", text); 

Upvotes: 0

Views: 94

Answers (1)

EylM
EylM

Reputation: 6103

From MSDN, Comments:

ActivePresentation.Slides(1).Comments.Add _
        Left:=0, Top:=0, Author:="John Doe", AuthorInitials:="jd", _
        Text:="Please check this spelling again before the next draft."

You are passing an empty string as author in your code.

Upvotes: 0

Related Questions