I am reasonably new to programming so please try to ignore any obvious questions I might ask.
I am trying to create a link back and forth between a CRM program I have and outlook.
I currently can go to outlook but not the other way around.
Here's that Code.
DEF VAR hout as com-handle.
DEF VAR hitem as com-handle.
CASE p-state:
WHEN "items" THEN DO:
IF AVAIL prospers THEN DO:
FIND prospect WHERE
prospect.cid = gkcid AND
prospect.div = gkdiv AND
prospect.prospect = prospers.prospect NO-LOCK NO-ERROR.
IF AVAIL prospect THEN DO:
create "outlook.application" hout.
hitem = hout:createitem(2). /* olContactItem = 2 */
hitem:FullName = prospers.NAME.
hitem:JobTitle = prospers.perstitle.
hitem:Companyname = prospers.prospect.
hitem:Email1Address = prospers.email.
hitem:BusinessTelephoneNumber = prospers.telephone1.
hitem:Business2TelephoneNumber = prospers.ext.
hitem:BusinessAddress = prospers.Address1.
hitem:BusinessAddressCity = prospers.city.
hitem:BusinessAddressState = prospers.State.
hitem:BusinessAddressPostalCode= prospers.postalcd.
hitem:BusinessAddressCountry = prospers.country.
hitem:BusinessAddressCity = prospers.city.
hitem:Nickname = prospers.nickname.
hitem:Body= prospers.notes.
NO-RETURN-VALUE hitem:close(0). /* Close & Save = 0 */
RELEASE OBJECT hitem.
RELEASE OBJECT hout.
END.
END.
END.
END CASE.
However I don't know how to pull things out? Please forgive the incomplete nature of the following code:
def var hout as com-handle.
def var hitem as com-handle.
FIND prospect WHERE
Prospect.cid = "Test" AND
prospect.div = "TEST" AND
prospect.prospect = "Testprospect" NO-LOCK NO-ERROR.
create "outlook.application" hout.
hitem = hout:createitem(2). /* olContactItem = 2 */
IF hitem:FullName = "Bob Smith" THEN DO:
prospect.telephone1 = Hitem:BusinessTelephoneNumber.
NO-RETURN-VALUE hitem:close(0). /* Close & Save = 0 */
RELEASE OBJECT hitem.
RELEASE OBJECT hout.
And this runs, however nothing is in prospect.telephone1.
Then I found this code on progress talk:
DEFINE VARIABLE hOutlook AS COM-HANDLE NO-UNDO.
DEFINE VARIABLE hNameSpace AS COM-HANDLE NO-UNDO.
DEFINE VARIABLE hFolder AS COM-HANDLE NO-UNDO.
DEFINE VARIABLE hItem AS COM-HANDLE NO-UNDO.
DEFINE VARIABLE X AS INTEGER NO-UNDO.
CREATE "Outlook.Application" hOutlook.
hNameSpace = hOutlook:GetNameSpace("MAPI").
hFolder = hNameSpace:AddressLists:ITEM(1).
DO X = 1 TO hFolder:AddressEntries:COUNT.
hItem = hFolder:AddressEntries:ITEM(X).
MESSAGE hItem:name.
END.
RELEASE OBJECT hItem.
RELEASE OBJECT hFolder.
RELEASE OBJECT hNameSpace.
RELEASE OBJECT hOutlook.
And the hITem:name is all that will work, and I didn't even think that was standard field. And it doesn't pull out name, only email. I tried changing this to fullname, thinking I was on the right track, but I'm stuck and I'm not really too sure what to try.
I apologize again if this all very obvious, and I thank you in the future should someone sees the error of my ways and can quickly help me.
Have a great day.
Tom
I am trying to create a link back and forth between a CRM program I have and outlook.
I currently can go to outlook but not the other way around.
Here's that Code.
DEF VAR hout as com-handle.
DEF VAR hitem as com-handle.
CASE p-state:
WHEN "items" THEN DO:
IF AVAIL prospers THEN DO:
FIND prospect WHERE
prospect.cid = gkcid AND
prospect.div = gkdiv AND
prospect.prospect = prospers.prospect NO-LOCK NO-ERROR.
IF AVAIL prospect THEN DO:
create "outlook.application" hout.
hitem = hout:createitem(2). /* olContactItem = 2 */
hitem:FullName = prospers.NAME.
hitem:JobTitle = prospers.perstitle.
hitem:Companyname = prospers.prospect.
hitem:Email1Address = prospers.email.
hitem:BusinessTelephoneNumber = prospers.telephone1.
hitem:Business2TelephoneNumber = prospers.ext.
hitem:BusinessAddress = prospers.Address1.
hitem:BusinessAddressCity = prospers.city.
hitem:BusinessAddressState = prospers.State.
hitem:BusinessAddressPostalCode= prospers.postalcd.
hitem:BusinessAddressCountry = prospers.country.
hitem:BusinessAddressCity = prospers.city.
hitem:Nickname = prospers.nickname.
hitem:Body= prospers.notes.
NO-RETURN-VALUE hitem:close(0). /* Close & Save = 0 */
RELEASE OBJECT hitem.
RELEASE OBJECT hout.
END.
END.
END.
END CASE.
However I don't know how to pull things out? Please forgive the incomplete nature of the following code:
def var hout as com-handle.
def var hitem as com-handle.
FIND prospect WHERE
Prospect.cid = "Test" AND
prospect.div = "TEST" AND
prospect.prospect = "Testprospect" NO-LOCK NO-ERROR.
create "outlook.application" hout.
hitem = hout:createitem(2). /* olContactItem = 2 */
IF hitem:FullName = "Bob Smith" THEN DO:
prospect.telephone1 = Hitem:BusinessTelephoneNumber.
NO-RETURN-VALUE hitem:close(0). /* Close & Save = 0 */
RELEASE OBJECT hitem.
RELEASE OBJECT hout.
And this runs, however nothing is in prospect.telephone1.
Then I found this code on progress talk:
DEFINE VARIABLE hOutlook AS COM-HANDLE NO-UNDO.
DEFINE VARIABLE hNameSpace AS COM-HANDLE NO-UNDO.
DEFINE VARIABLE hFolder AS COM-HANDLE NO-UNDO.
DEFINE VARIABLE hItem AS COM-HANDLE NO-UNDO.
DEFINE VARIABLE X AS INTEGER NO-UNDO.
CREATE "Outlook.Application" hOutlook.
hNameSpace = hOutlook:GetNameSpace("MAPI").
hFolder = hNameSpace:AddressLists:ITEM(1).
DO X = 1 TO hFolder:AddressEntries:COUNT.
hItem = hFolder:AddressEntries:ITEM(X).
MESSAGE hItem:name.
END.
RELEASE OBJECT hItem.
RELEASE OBJECT hFolder.
RELEASE OBJECT hNameSpace.
RELEASE OBJECT hOutlook.
And the hITem:name is all that will work, and I didn't even think that was standard field. And it doesn't pull out name, only email. I tried changing this to fullname, thinking I was on the right track, but I'm stuck and I'm not really too sure what to try.
I apologize again if this all very obvious, and I thank you in the future should someone sees the error of my ways and can quickly help me.
Have a great day.
Tom