Change Outlook settings using VSTO

混江龙づ霸主 提交于 2019-12-10 17:47:04

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!