The Forums on slxdeveloper.com are now retired. The forum archive will remain available for the time being. Thank you for your participation on slxdeveloper.com!
|
|
Working with Outlook and Saleslogix from .NET
Posted: 03 May 07 10:09 AM
|
fiogf49gjkf0d I already posted this thread in the Scripting section, "My New .NET Notes/History User Control is Missing Drag-and-Drop Attachments from Outlook" so I'm not going to repost it here.
I will ask the simple questions here though: How does Saleslogix get around the Outlook Security and extract attachments? Is there just a little setting in Outlook or the Reegistry you can tweak? Does it use MAPI? Either way, how do I get Attachments out of a MailItem or MapiObject easily? Can I call SlgxApi.dll from .NET to just do it for me, somehow?
|
|
|
| |
| |
|
Re: Working with Outlook and Saleslogix from .NET
Posted: 03 May 07 2:25 PM
|
fiogf49gjkf0d Thank you for your suggestions Scott and Ryan. I was able to access MailItem.Attachments after installing the free distribution provided here, http://www.mapilab.com/outlook/security/ , which I found after getting the Sue Mosher link and looking around in there, however I'm worried about the security implications of that plug-in since that shut it down completely across the board. I am going to try Redemption, and see if I can specify that my program is the only one that has access to by-pass Outlook security without warning. Either that, or try the MAPI route again.
|
|
|
| |
| |
|
Re: Working with Outlook and Saleslogix from .NET
Posted: 03 May 07 6:04 PM
|
fiogf49gjkf0d It works. Redemption works. I feel like Doc Brown seeing the DeLorean go Back to the Future for the first time. I actually haven't even purchased the redistributable license yet...
---
private void dataGridView1_DragDrop(object sender, DragEventArgs e) { if (e.Data.GetDataPresent(DataFormats.Text)) { e.Effect = DragDropEffects.Copy; DataObject d = ((DataObject)e.Data); String strCheck = ""; if (e.Data.GetDataPresent("Object Descriptor")) { try { MemoryStream myMem = new MemoryStream(); Byte[] myByte = new Byte[10000]; myMem = (MemoryStream)e.Data.GetData("Object Descriptor", true); myByte = myMem.ToArray(); myMem.Close(); for (int i = 0; i < myByte.Length - 1; i++) { if (myByte[i] > 0) { strCheck += Convert.ToChar(myByte[i]); } } } catch (Exception ex7) { } } try { Outlook.MailItem myMailItem = null; if (strCheck.ToLower().IndexOf("outlook") != -1) { Outlook.ApplicationClass myOlApp = new Outlook.ApplicationClass(); Outlook.Explorer myExp = myOlApp.ActiveExplorer(); myMailItem = (Outlook.MailItem)myExp.Selection[1]; myExp = null; myOlApp = null; } else { } if (myMailItem != null) { object oMissing = System.Reflection.Missing.Value; Microsoft.Office.Interop.Outlook.Application app = new Microsoft.Office.Interop.Outlook.Application(); Microsoft.Office.Interop.Outlook.NameSpace ns = app.GetNamespace("MAPI"); Redemption.RDOSessionClass rdoSession = new Redemption.RDOSessionClass(); rdoSession.MAPIOBJECT = ns.MAPIOBJECT; Redemption.RDOAddressBook rdoAdd = rdoSession.AddressBook; Redemption.RDOFolder rdoFld = rdoSession.GetDefaultFolder(rdoDefaultFolders.olFolderInbox); RDOMail m = rdoSession.GetMessageFromID(myMailItem.EntryID, oMissing, oMissing); richTextBox1.Text = m.Body; for (int i= 0; i < m.Attachments.Count+1; i++) { m.Attachments[i].SaveAsFile("C:\\"+m.Attachments[i].FileName); } } myMailItem = null; } catch (Exception e2) {
MessageBox.Show(e2.Message); } } }
|
|
|
|