Creating objects in Outlook in Shared Folders

Is there anyone who have som lines of code to spare wich shows me how to create outlook objects in a shared folder with automation? Creating an object of the type “post” in the inbox is no problem. What i want to do is to write to a specific shared folder and fill in custom fields which are used in that folder. Edited by - Lars Westman on 12/14/00 3:37:32 PM Edited by - Lars Westman on 12/14/00 3:58:28 PM

Since no one hade the lines I had to find them out myself Here’s the solution to anyone hos interested in how to create objects in shared folders in outlook. These objects also has custom controls (UserProperties). We use this solution to maintain documentation and tasks for our projects in outlook. CLEARALL; CREATE(OlApp); //Position to the right folder OlFolders := OlApp.GetNameSpace(‘MAPI’).Folders; OlMapiFolder := OlFolders.Item(‘Public Folders’); OlFolders := OlMapiFolder.Folders; OlMapiFolder := OlFolders.Item('Favorites); OlFolders := OlMapiFolder.Folders; OlMapiFolder := OlFolders.Item(‘Jobs’); OlPostItem := OlMapiFolder.Items.Add(‘IPM.Post.Job’); //A custom form OlPostItem.Subject := Job.“No”; OlUserProperties := OlPostItem.UserProperties; Job.CALCFIELDS(Name); IF NOT Res.GET(Job.“Person Responsible”) THEN Res.INIT; OlUserProperty := OlUserProperties.FIND(‘JobName’); OlUserProperty.Value := Job.Name; OlUserProperty := OlUserProperties.FIND(‘JobStatus’); CASE Job.Status OF --Job.Status::Quote: ----OlUserProperty.Value := ‘Quote’; --Job.Status::Order: ----OlUserProperty.Value := ‘Order’; --Job.Status::Completed: ----OlUserProperty.Value := ‘Completed’; END; OlUserProperty := OlUserProperties.FIND(‘JobDescr.’); OlUserProperty.Value := Job.Description; OlUserProperty := OlUserProperties.FIND(‘JobResponsible’); OlUserProperty.Value := Res.Name; OlPostItem.Save;

thanks. I could use the basics for my program to change contacts in outlook every time i change the customers in NF. However i Still have a problem. I can perform a find in the contact-folder but if the find returns nothing i get an errormessage. CREATE(app); NameSpace:=app.GetNamespace(‘mapi’); app.ActiveWindow; Folder:=app.GetNamespace(‘mapi’).Folders; mapiFolder:=Folder.Item(‘public Folders’); Folder:=mapiFolder.Folders; mapiFolder:=Folder.Item(‘all public Folders’); Folder:=mapiFolder.Folders; mapiFolder:=Folder.Item(’_pf-address lists Metro-Vannieuwenhuyze Vera (bizvdm)-biz’); Folder:=mapiFolder.Folders; items:=mapiFolder.Items; Item:=items.Find(’[fullname] = “‘Customer.Name’”’); if the find returns the exact contact-item everything is OK, but if the find returns an empty (nothing) item i get an error (can’t fill item with an empty item, or something like that) i can’t check the find because it doesn’t return a boolean and i can’t compare it with a “nothing” (as in VB and the examples in VBAoutl.chm) can someone help me?? thanks Tom Delchambre Metro

Hi Tom. Nice to see that You could use some of my code. I did this by counting the number of items that the restrict method gives me. I put the example below in a function that a call to check if the item exists in Outlook. If it returns TRUE I modify the item otherwise I create it. OlItems := OlMapiFolder.Items.Restrict(’[OutlookField] = “’ + NFvar + '”’); IF OlItems.Count = 0 THEN --EXIT(FALSE) ELSE --OlPostItem := OlMapiFolder.Items.Find(’[OutlookField] = “’ + NFvar + '”’); EXIT(TRUE); Hope it works for You //Lars