问题描述
在创建新的.pst文件后,仅使用新的Outlook.Store(.pst)创建了2个文件夹.
After creating a new .pst file only 2 folders are created with the new Outlook.Store(.pst).
示例1:
在关闭Outlook并重新打开它之后,将创建几个文件夹.一些是标准文件夹,例如回收站,RSSFeed等.但是有些很奇怪,并且名字很奇怪(带有奇怪的字符).
After you close Outlook and reopen it, several folders are created.Some are standard folders, such as Recycle Bin, RSSFeed, and more. But some are strange and have strange names (with strange characters).
示例2:
当我调试COM加载项的例程时,我已经确定在加载项的启动"事件中,有一个代码可以检查Outlook.Store的默认文件夹.
When I was debugging the routine of my COM Addin I have identified that in Addin's 'Startup' event, there is a code that checks the default folders of the Outlook.Store.
使用Outlook.Store对象的'GetDefaultFolder'方法. Microsoft建议使用此方法来识别Outlook.Store的默认文件夹.
The 'GetDefaultFolder' method of the Outlook.Store object is used. This method is recommended by Microsoft to identify the default folders of an Outlook.Store.
执行此方法时,根据参数,它将在Outlook.Store中创建文件夹.我创建了一个简单的COM插件来举例说明:
When this method is executed, depending on the parameter, it creates the folder in Outlook.Store. I created a simple COM Addin to exemplify:
在启动事件中,我这样做了:
In the Startup event I did this:
private StringBuilder sb = new StringBuilder("##Log##");
//Startup
Outlook.NameSpace ns = OutlookApp.Session;
Outlook.Store lastStore = ns.Stores[1];//Just to get the new Store
GetDefaultFolder(lastStore, Outlook.OlDefaultFolders.olFolderCalendar);
GetDefaultFolder(lastStore, Outlook.OlDefaultFolders.olFolderConflicts);
GetDefaultFolder(lastStore, Outlook.OlDefaultFolders.olFolderContacts);
GetDefaultFolder(lastStore, Outlook.OlDefaultFolders.olFolderDeletedItems);
GetDefaultFolder(lastStore, Outlook.OlDefaultFolders.olFolderDrafts);
GetDefaultFolder(lastStore, Outlook.OlDefaultFolders.olFolderInbox);
GetDefaultFolder(lastStore, Outlook.OlDefaultFolders.olFolderJournal);
GetDefaultFolder(lastStore, Outlook.OlDefaultFolders.olFolderJunk);
GetDefaultFolder(lastStore, Outlook.OlDefaultFolders.olFolderLocalFailures);
GetDefaultFolder(lastStore, Outlook.OlDefaultFolders.olFolderManagedEmail);
GetDefaultFolder(lastStore, Outlook.OlDefaultFolders.olFolderNotes);
GetDefaultFolder(lastStore, Outlook.OlDefaultFolders.olFolderOutbox);
GetDefaultFolder(lastStore, Outlook.OlDefaultFolders.olFolderRssFeeds);
GetDefaultFolder(lastStore, Outlook.OlDefaultFolders.olFolderSentMail);
GetDefaultFolder(lastStore, Outlook.OlDefaultFolders.olFolderServerFailures);
GetDefaultFolder(lastStore, Outlook.OlDefaultFolders.olFolderSuggestedContacts);
GetDefaultFolder(lastStore, Outlook.OlDefaultFolders.olFolderSyncIssues);
GetDefaultFolder(lastStore, Outlook.OlDefaultFolders.olFolderTasks);
GetDefaultFolder(lastStore, Outlook.OlDefaultFolders.olFolderToDo);
GetDefaultFolder(lastStore, Outlook.OlDefaultFolders.olPublicFoldersAllPublicFolders);
System.Diagnostics.Debug.Write(sb.ToString());
private void GetDefaultFolder(Outlook.Store newStore, Outlook.OlDefaultFolders olFolderKind)
{
Outlook.MAPIFolder rootFolder = null;
rootFolder = newStore.GetRootFolder();
sb.AppendLine($"qtd: {rootFolder.Folders.Count}");
try
{
sb.AppendLine($"Folder kind: {olFolderKind.ToString()}");
newStore.GetDefaultFolder(olFolderKind);
}
catch
{
}
finally
{
sb.AppendLine($"qtd: {rootFolder.Folders.Count}");
sb.AppendLine();
sb.AppendLine();
if (rootFolder != null)
Marshal.ReleaseComObject(rootFolder);
}
}
我加载新的.pst文件(Outlook.Store)并获取所有默认文件夹.但是在某些情况下,会添加新的文件夹.
I load the new .pst file (Outlook.Store) and fetch all default folders. But in a few cases new Folders are added.
此代码的日志为:
Ex
qtd:1文件夹种类:olFolderCalendarqtd:2
qtd: 1Folder kind: olFolderCalendarqtd: 2
qtd:2文件夹类型:olFolderConflictsqtd:2
qtd: 2Folder kind: olFolderConflictsqtd: 2
qtd:2文件夹种类:olFolderContactsqtd:3
qtd: 2Folder kind: olFolderContactsqtd: 3
qtd:3文件夹类型:olFolderDeletedItemsqtd:3
qtd: 3Folder kind: olFolderDeletedItemsqtd: 3
qtd:3文件夹种类:olFolderDraftsqtd:4
qtd: 3Folder kind: olFolderDraftsqtd: 4
qtd:4文件夹种类:olFolderInboxqtd:4
qtd: 4Folder kind: olFolderInboxqtd: 4
qtd:4文件夹种类:olFolderJournalqtd:5
qtd: 4Folder kind: olFolderJournalqtd: 5
qtd:5文件夹种类:olFolderJunkqtd:6
qtd: 5Folder kind: olFolderJunkqtd: 6
qtd:6文件夹类型:olFolderLocalFailuresqtd:6
qtd: 6Folder kind: olFolderLocalFailuresqtd: 6
qtd:6文件夹类型:olFolderManagedEmailqtd:6
qtd: 6Folder kind: olFolderManagedEmailqtd: 6
qtd:6文件夹种类:olFolderNotesqtd:7
qtd: 6Folder kind: olFolderNotesqtd: 7
qtd:7文件夹种类:olFolderOutboxqtd:8
qtd: 7Folder kind: olFolderOutboxqtd: 8
qtd:8文件夹种类:olFolderRssFeedsqtd:9
qtd: 8Folder kind: olFolderRssFeedsqtd: 9
qtd:9文件夹类型:olFolderSentMailqtd:9
qtd: 9Folder kind: olFolderSentMailqtd: 9
qtd:9文件夹类型:olFolderServerFailuresqtd:9
qtd: 9Folder kind: olFolderServerFailuresqtd: 9
qtd:9文件夹类型:olFolderSuggestedContactsqtd:9
qtd: 9Folder kind: olFolderSuggestedContactsqtd: 9
qtd:9文件夹类型:olFolderSyncIssuesqtd:9
qtd: 9Folder kind: olFolderSyncIssuesqtd: 9
qtd:9文件夹类型:olFolderTasksqtd:10
qtd: 9Folder kind: olFolderTasksqtd: 10
qtd:10文件夹种类:olFolderToDoqtd:10
qtd: 10Folder kind: olFolderToDoqtd: 10
qtd:10文件夹类型:olPublicFoldersAllPublicFoldersqtd:10
qtd: 10Folder kind: olPublicFoldersAllPublicFoldersqtd: 10
Outlook创建的这个奇怪的文件夹是什么?为什么Outlook.Store.GetDefaultFolder方法创建文件夹?是否可以使用另一种方法返回与GetDefaultFolder相同的信息,但不创建文件夹?
What is this strange folder created by Outlook?Why is the Outlook.Store.GetDefaultFolder method creating folders?Is there another method that can be used that returns the same information as the GetDefaultFolder but DOES NOT create folders?
推荐答案
方法不能也不应该在Outlook中创建文件夹.
The GetDefaultFolder method of the Store
or Namespace
class doesn't and shouldn't create folders in Outlook.
首先,我看到一个在Outlook(DocSite)中运行的自定义加载项.在使用OOM创建任何测试之前,我建议禁用所有测试.
First of all, I see a custom add-ins running in Outlook (DocSite). Before creating any test with OOM I'd suggest to disable all of them.
我还看到了在Outlook中配置的一个有趣的域名.是IMAP还是Exchange配置文件?如果是这样,我建议改为配置任何SMTP邮箱.
Also I see an interesting domain name configured in Outlook. Is it IMAP or Exchange profile? If so, I'd suggest configuring any SMTP mail box instead.
是自定义商店提供商吗?
Is a custom store provider?
这篇关于Outlook.Store.GetDefaultFolder Outlook在新的.pst文件中创建奇怪的文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!