dcsimg
Results 1 to 15 of 15

Thread: [RESOLVED] MAPISession.SignOn Not Setting SessionID Win 7

  1. #1

    Thread Starter
    New Member
    Join Date
    Nov 2009
    Posts
    15

    Resolved [RESOLVED] MAPISession.SignOn Not Setting SessionID Win 7

    HI,
    So I have some MAPI code that work Just the way I want it to on XP and dosn't work at all on Windows 7. ( I wish I could find the time to just port the whole thing over to .net but I don't)
    EDIT For any one from the future reading this is the wrong way to go about sending to the desktop client. See post #15. Use Edanmo's code plus my tweak.
    Code:
    ' DFIMAPISession is a MAPISession on the form (MSMAPI32.oxc)
    'DFIMAPIMessages is a MAPIMessage on the form.
    
    'I develop on a Win 7 No Sp1
    Private Sub Command3_Click()
            Let DFIMAPISession.DownLoadMail = False
            '---------------------------------------------------
            'Sign on Session
            '---------------------------------------------------
            If (DFIMAPISession.SessionID = 0) Then
                Call DFIMAPISession.SignOn 'Runs fine
            End If
    
            With DFIMAPIMessages
                .SessionID = DFIMAPISession.SessionID 'Runst fine but SessionID = 0
                .Compose' Throws Mapi failure: Valid session id does not exist '32053'
                .AddressResolveUI = False
    
                .MsgSubject = "This is a subject."
                .MsgNoteText = "This is a body."
    
                .RecipIndex = 0
                .RecipType = 1
                .RecipAddress = "smtp: ron82@gmal.co"
                .RecipDisplayName = "smtp: ron82@gmal.co"
                
                .Send True
            End With
    End Sub
    I've Also Tried this http://support.microsoft.com/kb/163216 but it seems geared toward just outlook and still doesn't work at all on win 7.

    What I'm trying to accomplish is an emulation of right Click Sendto > Mail Recipient but from my VB6 application. I currently am using a light CDO send mail form but more and more customers are asking that my program output be sent to their mail client.

    I've also looked at http://www.codeproject.com/Articles/...ck&fr=26#xx0xx

    and
    http://www.codeproject.com/Articles/...mail-recipient

    Thank you
    Ron
    Last edited by rhahn; Mar 5th, 2012 at 05:40 PM.

  2. #2
    Frenzied Member
    Join Date
    Nov 2010
    Posts
    1,464

    Re: MAPISession.SignOn Not Setting SessionID Win 7

    there is an identical piece of code on the web with the folling addendum

    Now there are a few gotchas that you have to be careful about…

    You need to set the RecipDisplayName correctly, if you do not, even if the RecipAddress is correct it will return an error.

    You also need to turn the AddressResolveUI to false…

    Provided you have those two things done… it should work fine…

    Good luck!
    hope that helps

  3. #3
    PowerPoster Nightwalker83's Avatar
    Join Date
    Dec 2001
    Location
    Adelaide, Australia
    Posts
    13,346

    Re: MAPISession.SignOn Not Setting SessionID Win 7

    Not sure if my code in the first post here would help?
    when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
    If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu.
    https://get.cryptobrowser.site/30/4111672

  4. #4
    PowerPoster
    Join Date
    Feb 2006
    Posts
    20,323

    Re: MAPISession.SignOn Not Setting SessionID Win 7

    This doesn't fix the problem but it's a suggestion.

    Microsoft and other large vendors have completely given up on using email to send crash reports and feedback from within programs. Lots of this is simply due to "hardening" against exploits within the global SMTP network, operating systems, email clients, and email servers. MAPI in particular is losing ground as a practical tool because the pressure of exploits has led Microsoft to stop including a local mail client in Windows out of the box and for that matter even corporate users are moving to hosted Web-based mail like GMail.

    That last point was the deal-killer for me, and adoption of 3rd party hosted email is only growing.

    You appear to be using the VB6 MAPI controls, which in turn use Simple MAPI which is sometimes not provided by some email client software and has erratic support at best in current Windows versions.


    In light of this you might consider doing what others do. Most Microsoft products seem to use some sort of Web Service to phone home with these kids of posts now. I've moved to WebDAV because it requires less infrastructure development on the server side (you can "rent" hosted WebDAV space cheaply or even for free).

    You still want to pop up a dialog informing the user, and perhaps even offer them a "don't send" opt-out button. And you still might want to offer a "see details" button to pop up a secondary dialog or expanded window showing them what you are going to send. You might even offer them a "save details to disk" button for the truly paranoid.

    But email is basically dead for this kind of thing.

  5. #5

    Thread Starter
    New Member
    Join Date
    Nov 2009
    Posts
    15

    Re: MAPISession.SignOn Not Setting SessionID Win 7

    incidentals: Yes my code is Identical to the code you found. It's where I got it from but I couldn't find the address in by history. My code throws on .Compose so I don't get a chance to set .AddrssResolveUI or .RecipDisplayName. I've tried moving .Compose down but all that does is push the problem of no SessionID to .MsgSubject where I get a "Property is read only when not using a compose buffer.

    Nightwalker83: Your code need Redemption or Outlook. I can't tell my customers to switch to Outlook. It looks like Redemption needs outlook too.

    The problem is I can't tell my customers to all switch over to Outlook, at that point my software becomes too expensive for them. My code above works i xp. How do I make it work in Windows 7?

    I know that email is on its way out but I currently have a little over a thousand customers that want user their desktop email client. So That is what I'm attempting to facilitate.

    dilettante: I currently am using a form I made that does what you suggest, throws the output to a save as and transmits it to another system they have access to. But now they need to email this data to their customers and they want it sent as an attachment to their desktop email client.


    So the code about works in XP. In windows 7 I can right click on a file in Explorer, Select Send To -> Mail Recipient and the default mail Client (as set by Default Programs) opens to it's compose screen with that file as it's attachment (Hell if it's a jpg it even asks what size you want it!) There must be a way to tap into this space magic from VB. I'm trying to figure out how

  6. #6
    PowerPoster Spoo's Avatar
    Join Date
    Nov 2008
    Location
    Right Coast
    Posts
    2,656

    Re: MAPISession.SignOn Not Setting SessionID Win 7

    Ron

    No help here re your specific issue, but ...

    You might want to consider editing your OP
    and removing your e-mail address (assuming it
    is your real one) .... spam-bots, etc.

    Spoo

  7. #7

    Thread Starter
    New Member
    Join Date
    Nov 2009
    Posts
    15

    Re: MAPISession.SignOn Not Setting SessionID Win 7


  8. #8
    PowerPoster
    Join Date
    Feb 2006
    Posts
    20,323

    Re: MAPISession.SignOn Not Setting SessionID Win 7

    Ok, after a bunch of digging I found: SendTo mail recipient

    Fairly intriguing, but also fairly useless in VB6.

    So this got me to: Sending a file to "Mail Recipient" using sendmail.dll

    To use that code (which does the same thing as far as I can see) you will probably need his OLELIB.TLB - OLE interfaces & functions v1.7, which you can get at Visual Basic 6

  9. #9
    PowerPoster
    Join Date
    Feb 2006
    Posts
    20,323

    Re: MAPISession.SignOn Not Setting SessionID Win 7

    Doh!

    Late on the button as always.

  10. #10

    Thread Starter
    New Member
    Join Date
    Nov 2009
    Posts
    15

    Re: MAPISession.SignOn Not Setting SessionID Win 7

    Well dilettante, We followed the exact same path to this one. I wish I could figure out how emorcillo did all this. It's pretty amazing stuff!

    Thanks for your Help!

  11. #11
    PowerPoster Nightwalker83's Avatar
    Join Date
    Dec 2001
    Location
    Adelaide, Australia
    Posts
    13,346

    Re: MAPISession.SignOn Not Setting SessionID Win 7

    Does this help?
    when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
    If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu.
    https://get.cryptobrowser.site/30/4111672

  12. #12

    Thread Starter
    New Member
    Join Date
    Nov 2009
    Posts
    15

    Re: MAPISession.SignOn Not Setting SessionID Win 7

    It might but then my customers would need to mess around with hot fixes and it comes down to a maintenance issue again. And god only know what else might break after installing. I wish I was the only pice of software they used and that they all used the same computer but if it was that easy no one would pay us to do this.


    I'm new to this forums stuff. How do you close a call

  13. #13
    PowerPoster Nightwalker83's Avatar
    Join Date
    Dec 2001
    Location
    Adelaide, Australia
    Posts
    13,346

    Re: MAPISession.SignOn Not Setting SessionID Win 7

    In post #7 you said you resolved the issue? If so follow the step in my signature. Also, which code on that website are you referring to?
    when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
    If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu.
    https://get.cryptobrowser.site/30/4111672

  14. #14
    PowerPoster Spoo's Avatar
    Join Date
    Nov 2008
    Location
    Right Coast
    Posts
    2,656

    Re: MAPISession.SignOn Not Setting SessionID Win 7

    Ron

    Nice going.

    As for
    I'm new to this forums stuff. How do you close a call
    click on Thread Tools dropdown box just above the 1st post,
    then select RESOLVED>

    Spoo

  15. #15

    Thread Starter
    New Member
    Join Date
    Nov 2009
    Posts
    15

    Re: MAPISession.SignOn Not Setting SessionID Win 7

    So the code on Edanmo's site only sends one file. To send more than one file in a folder do the following:


    Code:
    'some code to put your file names into FileName() is needed but not included here.
    for n = 0 to ubound(FileName)
      oParent.ParseDisplayName 0, 0, StrPtr(Filename(n)), 0, arrlPidl(n), 0
    next
    lPtr = oParent.GetUIObjectOf(0,ubound(FileName), arrlPidl(0), tIID_IDataObject, 0)
    Idea is to set up an ppidl array of the same len as the number of filenames you want to attach and call ParseDisplayName for each

    then in GetUIObjectOf tell it the number of objects to expect (Second Pram)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width