0
WPF-C# 응용 프로그램을 개발 중이며 Redemption을 사용하여 MS Outlook 2010 연락처 항목을 가져 오는 중입니다. 내 Outlook SMTP 계정이 하나만 있으면 잘 작동합니다. 그러나 Exchange 서버 계정 인 다른 계정을 구성하면 동일한 코드에서 연락처 항목을 가져 오지 못합니다. 그때 내 Exchange 서버 계정을 삭제하면 Outlook 2010에서 연락처 항목을 가져 오지 못함
Interop.Redemption.RDOItems folderItems = null;
Interop.Redemption.RDOFolder folderContacts = null;
Interop.Redemption.RDOFolder folderSuggestedContacts = null;
List<GMContactItem> allOutlookContacts = null;
object itemObj = null;
List<Interop.Redemption.RDOContactItem> contactItemsList = null;
try
{
folderContacts = (RDOFolder)RDOSessionItem.GetDefaultFolder(Interop.Redemption.rdoDefaultFolders.olFolderContacts);
contactItemsList = new List<RDOContactItem>();
folderItems = folderContacts.Items;
for (int i = 1; folderItems.Count >= i; i++)
{
itemObj = folderItems[i];
if (itemObj is Interop.Redemption.RDOContactItem)
contactItemsList.Add(itemObj as RDOContactItem);
else
Marshal.ReleaseComObject(itemObj);
}
Marshal.ReleaseComObject(folderItems);
folderItems = null;
// getting items from the Suggested Contacts folder in Outlook
folderSuggestedContacts = RDOSessionItem.GetDefaultFolder(
rdoDefaultFolders.olFolderSuggestedContacts);
if (folderSuggestedContacts != null)
{
folderItems = folderSuggestedContacts.Items;
for (int i = 1; folderItems.Count >= i; i++)
{
itemObj = folderItems[i];
if (itemObj is Interop.Redemption.RDOContactItem)
contactItemsList.Add(itemObj as Interop.Redemption.RDOContactItem);
else
Marshal.ReleaseComObject(itemObj);
}
}
}
catch (System.Exception ex)
{
System.Windows.Forms.MessageBox.Show(ex.ToString());
}
그것이 잘 작동하고 내가 Outlook에서 Exchange 서버 계정을 추가하는 경우 다음이 코드는 예외가 없습니다 있지만 연락처 항목을 제공하지 않습니다 : 다음은 내 코드입니다. 아무도 나에게 여기서 어떤 문제가 될 수 있다고 제안 할 수 있습니까? 미리 감사드립니다.
수야
Exchange 사서함의 연락처 폴더에 항목이 있습니까? –
안녕하세요 드미트리, 기본적으로 하나의 SMPT이고 다른 하나는 Exchange 서버입니다. 네, 선택 대화 상자를 열면 많은 연락처가 포함되어 있기 때문에 교환 사서함에 연락처가 있습니다. 이 외에도 SMTP 계정 인 두 번째 계정은 주소록에도 많은 연락처가 있습니다. 또한 Outlook 2007과 동일한 응용 프로그램을 실행하면 작업이 잘됩니다. –