问题
I have just spent about 4 hours trying to figure out how to retrieve/set outlook settings for Microsoft Outlook 2010 programmatically. What i mean by 'settings' is settings under the File/Options/Mail. What i am trying to do is to retrieve a list of settings set by the user, automate a whole print process that we need to run daily on some messages and then restore the settings. to their original.
I have noticed that in Word the code below can be used to set certain settings through Word.Application.Options but i just cannot find any properties or method in outlook to achieve this. any help will be much appreciated.
Word.Application application = (Word.Application)initialiseApps(AppNames.Word);
Word.Options options = application.Options;
wordSettings.PrintDrawingObjects = options.PrintDrawingObjects;
wordSettings.PrintBackgrounds = options.PrintBackgrounds;
wordSettings.PrintProperties = options.PrintProperties;
wordSettings.PrintHiddenText = options.PrintHiddenText;
wordSettings.UpdateFieldsAtPrint = options.UpdateFieldsAtPrint;
wordSettings.PrintFieldCodes = options.PrintFieldCodes;
wordSettings.MapPaperSize = options.MapPaperSize;
application.Quit();
Marshal.ReleaseComObject(options);
Marshal.ReleaseComObject(application);
来源:https://stackoverflow.com/questions/11454835/change-outlook-settings-using-vsto