Replace olFolderContacts for Sharepoint lists in Outlook

Status
Not open for further replies.
A

Alexnts

Good morning to all :)

I am using this piece of code here

http://www.vboffice.net/en/developers/edit-internet-format-for-contact

to massively change the internet format field of Sharepoint Contacts in

Outlook.

It works like a charm in the local contact list but not in the cached

Sharepoint lists.

The problem is at this line i think.

Set Items = Session.GetDefaultFolder(olFolderContacts).Items

How can i set the script to selectand workon the Sharepoint lists(local

cached) instead of the local lists?

.
 
S

Sue Mosher [MVP]

To get a non-default folder, you need to walk the folder hierarchy using the

Folders collections or use a function that does that for you. For examples,

see:

http://www.outlookcode.com/codedetail.aspx?id=628 - uses a folder path

string

http://www.outlookcode.com/codedetail.aspx?id=492 - searches for a folder by

name

What you're trying to do may not work, though, because (a) SharePoint simply

doesn't support all the fields and functionality of Outlook contacts and (b)

the synchronization process may overwrite whatever changes you make in the

local cached copy of the SharePoint list. I would make the change on an

individual contact and see what happens at the next sync, before making an

investment in coding something bigger.

Sue Mosher

"Alexnts" <Alexnts> wrote in message

news:028C080A-B525-44FF-9DA8-8142070C14BF@microsoft.com...
> Good morning to all :)

> I am using this piece of code here
> http://www.vboffice.net/en/developers/edit-internet-format-for-contact
> to massively change the internet format field of Sharepoint Contacts in
> Outlook.
> It works like a charm in the local contact list but not in the cached
> Sharepoint lists.
> The problem is at this line i think.

> Set Items = Session.GetDefaultFolder(olFolderContacts).Items

> How can i set the script to selectand workon the Sharepoint lists(local
> cached) instead of the local lists?

> .
 
A

Alexnts

Hello Sue.

Thank you for your answer. :)

I am not trying to change any field on sharepoint directly.

I am trying to change the Internet format on the cached sharepoint list.

My whole scenario is this

www.tinyurl.com/defaultrtf (outlook contacts part of this forum)

Using Outlook 2007 the changes i make doesn't alter after a synchronization.

Outlook by default sets RTF to every imported contact (the imports may be

from Sharepoint or ActiveSync.It doesn't matter)

Unfortunately this is a setting that overrides the global mail format under

Outlook and produces winmail.dat attachements to every contact not using

Outlook. (yeah what a mess...) :)

A note about the second link that searches for a folder by name.

Unfortunately my programming skills are almost a joke, and i can't make it

work.

I guess that this code runs under ThisOutlookSession (Alt+F11).Right?

Also i can't seem to find the place where i insert the argument's name.

(' Arguments: strFolderName = name of folder to search for)

In which part of the code i enter my folder's name?

Let's say the folder's name is DefaultRTF.

Excuse my funny questions and my lousy English.

.

"Sue Mosher [MVP]" wrote:


> To get a non-default folder, you need to walk the folder hierarchy using the
> Folders collections or use a function that does that for you. For examples,
> see:

> http://www.outlookcode.com/codedetail.aspx?id=628 - uses a folder path
> string
> http://www.outlookcode.com/codedetail.aspx?id=492 - searches for a folder by
> name

> What you're trying to do may not work, though, because (a) SharePoint simply
> doesn't support all the fields and functionality of Outlook contacts and (b)
> the synchronization process may overwrite whatever changes you make in the
> local cached copy of the SharePoint list. I would make the change on an
> individual contact and see what happens at the next sync, before making an
> investment in coding something bigger.
> > Sue Mosher
> > >

> "Alexnts" <Alexnts> wrote in message
> news:028C080A-B525-44FF-9DA8-8142070C14BF@microsoft.com...
> > Good morning to all :)
> > I am using this piece of code here
> > http://www.vboffice.net/en/developers/edit-internet-format-for-contact
> > to massively change the internet format field of Sharepoint Contacts in
> > Outlook.
> > It works like a charm in the local contact list but not in the cached
> > Sharepoint lists.
> > The problem is at this line i think.
> > Set Items = Session.GetDefaultFolder(olFolderContacts).Items
> > How can i set the script to selectand workon the Sharepoint lists(local
> > cached) instead of the local lists?
> > .


>
 
S

Sue Mosher [MVP]

If you've already tested to see whether changes persist after a sync, that's

great. You should then have everything you need now to complete your

project.

The code sample at http://www.outlookcode.com/codedetail.aspx?id=492 is

designed as a generic function that can be used in many different

environments. To use it in Outlook VBA, either in ThisOutlookSession or

another module, you would want to change this statement:

Set objApp = CreateObject("Outlook.Application")

to

Set objApp = Application

in order to use the intrinsic Application object that Outlook VBA exposes.

The first comment on the code sample is an example of its usage.

GetFolderByName() is a function, so you pass the folder name to it as you

would any other function argument, e.g. MyFunction(myargument). Put it in

your code where you need to return the folder to work on.

Sue Mosher

"Alexnts" <Alexnts> wrote in message

news:5F8D3EED-4427-410D-9B35-67C92B520294@microsoft.com...
> Hello Sue.
> Thank you for your answer. :)
> I am not trying to change any field on sharepoint directly.
> I am trying to change the Internet format on the cached sharepoint list.
> My whole scenario is this
> www.tinyurl.com/defaultrtf (outlook contacts part of this forum)
> Using Outlook 2007 the changes i make doesn't alter after a
> synchronization.
> Outlook by default sets RTF to every imported contact (the imports may be
> from Sharepoint or ActiveSync.It doesn't matter)
> Unfortunately this is a setting that overrides the global mail format
> under
> Outlook and produces winmail.dat attachements to every contact not using
> Outlook. (yeah what a mess...) :)

> A note about the second link that searches for a folder by name.
> Unfortunately my programming skills are almost a joke, and i can't make it
> work.
> I guess that this code runs under ThisOutlookSession (Alt+F11).Right?
> Also i can't seem to find the place where i insert the argument's name.
> (' Arguments: strFolderName = name of folder to search for)
> In which part of the code i enter my folder's name?
> Let's say the folder's name is DefaultRTF.
> >>

> > "Alexnts" <Alexnts> wrote in message
> > news:028C080A-B525-44FF-9DA8-8142070C14BF@microsoft.com...
> > > Good morning to all :)
> >> > I am using this piece of code here
> > > http://www.vboffice.net/en/developers/edit-internet-format-for-contact
> > > to massively change the internet format field of Sharepoint Contacts in
> > > Outlook.
> > > It works like a charm in the local contact list but not in the cached
> > > Sharepoint lists.
> > > The problem is at this line i think.
> >> > Set Items = Session.GetDefaultFolder(olFolderContacts).Items
> >> > How can i set the script to selectand workon the Sharepoint lists(local
> > > cached) instead of the local lists?
> >> > .

>

>
>>
 
A

Alexnts

Thank you for your answer Sue!

Regarding GetFolderByName, from what i can understand i have to create a Sub

that calls this function.Right?

The code that rockman posts (in the first post) to run behind a button

doesn't seem work on me. (nothing happens).

I have also tried to test the code that Emory Brown posts in your " New

and improved GetFolder() function" posts but the debugger stops on "Dim regex

As RegExp"

Argghhh...

I really thought that i could bypass this bug of Outlook (regarding the

dafaultrtf) without having special programming skills.

.

Alex

"Sue Mosher [MVP]" wrote:


> If you've already tested to see whether changes persist after a sync, that's
> great. You should then have everything you need now to complete your
> project.

> The code sample at http://www.outlookcode.com/codedetail.aspx?id=492 is
> designed as a generic function that can be used in many different
> environments. To use it in Outlook VBA, either in ThisOutlookSession or
> another module, you would want to change this statement:

> Set objApp = CreateObject("Outlook.Application")

> to

> Set objApp = Application

> in order to use the intrinsic Application object that Outlook VBA exposes.

> The first comment on the code sample is an example of its usage.
> GetFolderByName() is a function, so you pass the folder name to it as you
> would any other function argument, e.g. MyFunction(myargument). Put it in
> your code where you need to return the folder to work on.

> > Sue Mosher
> > >

> "Alexnts" <Alexnts> wrote in message
> news:5F8D3EED-4427-410D-9B35-67C92B520294@microsoft.com...
> > Hello Sue.
> > Thank you for your answer. :)
> > I am not trying to change any field on sharepoint directly.
> > I am trying to change the Internet format on the cached sharepoint list.
> > My whole scenario is this
> > www.tinyurl.com/defaultrtf (outlook contacts part of this forum)
> > Using Outlook 2007 the changes i make doesn't alter after a
> > synchronization.
> > Outlook by default sets RTF to every imported contact (the imports may be
> > from Sharepoint or ActiveSync.It doesn't matter)
> > Unfortunately this is a setting that overrides the global mail format
> > under
> > Outlook and produces winmail.dat attachements to every contact not using
> > Outlook. (yeah what a mess...) :)
> > A note about the second link that searches for a folder by name.
> > Unfortunately my programming skills are almost a joke, and i can't make it
> > work.
> > I guess that this code runs under ThisOutlookSession (Alt+F11).Right?
> > Also i can't seem to find the place where i insert the argument's name.
> > (' Arguments: strFolderName = name of folder to search for)
> > In which part of the code i enter my folder's name?
> > Let's say the folder's name is DefaultRTF.
> > >
> >> "Alexnts" <Alexnts> wrote in message
> >> news:028C080A-B525-44FF-9DA8-8142070C14BF@microsoft.com...
> >> > Good morning to all :)
> >> >> > I am using this piece of code here
> >> > http://www.vboffice.net/en/developers/edit-internet-format-for-contact
> >> > to massively change the internet format field of Sharepoint Contacts in
> >> > Outlook.
> >> > It works like a charm in the local contact list but not in the cached
> >> > Sharepoint lists.
> >> > The problem is at this line i think.
> >> >> > Set Items = Session.GetDefaultFolder(olFolderContacts).Items
> >> >> > How can i set the script to selectand workon the Sharepoint lists(local
> >> > cached) instead of the local lists?
> >> >> > .
> >
> >
> >>


>
 
S

Sue Mosher [MVP]

Yes, your scenario needs a macro, which is a public, argumentless

subroutine. What happens when you step through the demo procedure in the

debugger? Have you checked the VBA basics at

http://outlookcode.com/article.aspx?id=49?

If you're not using regular expressions in your project, you don't need that

Dim statement from the other sample or any of the code that references

regex.

In general, you're going to have to understand the code in order to use it.

That doesn't mean "special" programming skills in your scenario, just basic

skills and a willingness to spend some time learning.

Sue Mosher

"Alexnts" <Alexnts> wrote in message

news:B8A74967-BD09-4EEC-85CE-A0291C6BC007@microsoft.com...
> Thank you for your answer Sue!

> Regarding GetFolderByName, from what i can understand i have to create a
> Sub
> that calls this function.Right?

> The code that rockman posts (in the first post) to run behind a button
> doesn't seem work on me. (nothing happens).
> I have also tried to test the code that Emory Brown posts in your " New
> and improved GetFolder() function" posts but the debugger stops on "Dim
> regex
> As RegExp"

> Argghhh...
> I really thought that i could bypass this bug of Outlook (regarding the
> dafaultrtf) without having special programming skills.

> .
> Alex

> "Sue Mosher [MVP]" wrote:
>
> > If you've already tested to see whether changes persist after a sync,
> > that's
> > great. You should then have everything you need now to complete your
> > project.
>

>> The code sample at http://www.outlookcode.com/codedetail.aspx?id=492 is
> > designed as a generic function that can be used in many different
> > environments. To use it in Outlook VBA, either in ThisOutlookSession or
> > another module, you would want to change this statement:
>

>> Set objApp = CreateObject("Outlook.Application")
>

>> to
>

>> Set objApp = Application
>

>> in order to use the intrinsic Application object that Outlook VBA
> > exposes.
>

>> The first comment on the code sample is an example of its usage.
> > GetFolderByName() is a function, so you pass the folder name to it as you
> > would any other function argument, e.g. MyFunction(myargument). Put it
> > in
> > your code where you need to return the folder to work on.
>

>> > > Sue Mosher
> > >> >> >
>
>> "Alexnts" <Alexnts> wrote in message
> > news:5F8D3EED-4427-410D-9B35-67C92B520294@microsoft.com...
> > > Hello Sue.
> > > Thank you for your answer. :)
> > > I am not trying to change any field on sharepoint directly.
> > > I am trying to change the Internet format on the cached sharepoint
> > > list.
> > > My whole scenario is this
> > > www.tinyurl.com/defaultrtf (outlook contacts part of this forum)
> > > Using Outlook 2007 the changes i make doesn't alter after a
> > > synchronization.
> > > Outlook by default sets RTF to every imported contact (the imports may
> > > be
> > > from Sharepoint or ActiveSync.It doesn't matter)
> > > Unfortunately this is a setting that overrides the global mail format
> > > under
> > > Outlook and produces winmail.dat attachements to every contact not
> > > using
> > > Outlook. (yeah what a mess...) :)
> >> > A note about the second link that searches for a folder by name.
> > > Unfortunately my programming skills are almost a joke, and i can't make
> > > it
> > > work.
> > > I guess that this code runs under ThisOutlookSession (Alt+F11).Right?
> > > Also i can't seem to find the place where i insert the argument's name.
> > > (' Arguments: strFolderName = name of folder to search for)
> > > In which part of the code i enter my folder's name?
> > > Let's say the folder's name is DefaultRTF.
> > > >
>> >> "Alexnts" <Alexnts> wrote in message
> > >> news:028C080A-B525-44FF-9DA8-8142070C14BF@microsoft.com...
> > >> > Good morning to all :)
> > >>> >> > I am using this piece of code here
> > >> > http://www.vboffice.net/en/developers/edit-internet-format-for-contact
> > >> > to massively change the internet format field of Sharepoint Contacts
> > >> > in
> > >> > Outlook.
> > >> > It works like a charm in the local contact list but not in the
> > >> > cached
> > >> > Sharepoint lists.
> > >> > The problem is at this line i think.
> > >>> >> > Set Items = Session.GetDefaultFolder(olFolderContacts).Items
> > >>> >> > How can i set the script to selectand workon the Sharepoint
> > >> > lists(local
> > >> > cached) instead of the local lists?
> > >>> >> > .
> > >
>> >
>> >>

>

>
>>
 
Status
Not open for further replies.
Similar threads
Thread starter Title Forum Replies Date
Beeto Replace a string in body Outlook VBA and Custom Forms 2
O How to find and replace a word in Outlook-Agenda-Subject and Message? Using Outlook 0
S HTML Code Embedded in String Within Open Outlook Email Preventing Replace(Application.ActiveInspector.CurrentItem.HTMLBody From Working Outlook VBA and Custom Forms 4
M Outlook 2013 Replace Subject with Conversation (a "hidden" value). Outlook VBA and Custom Forms 0
F Copy and replace not update contact in another pst Using Outlook 0
B Automatically Forward Emails and Remove/Replace All or Part of Body Outlook VBA and Custom Forms 8
C How to replace or delete first instance of sentence in mail body? Outlook VBA and Custom Forms 1
C replace subject line generated by converting a word document to PDF and sending it to an email Using Outlook 8
Diane Poremsky How to perform a global search and replace Using Outlook 0
B Delete/replace old files and save new attachments Using Outlook 1
Diane Poremsky Replace Display Names with Email Addresses Using Outlook 0
mrje1 Is there a Find and Replace feature in Outlook 2016? Using Outlook 4
J Pull an email address from body and replace reply-to address Outlook VBA and Custom Forms 4
divan Outlook 2007 - Replace email body with custom text Using Outlook 9
E VBScript to replace module? Using Outlook 3
A How to replace column title in address book Using Outlook 1
V Replace only part of subject in OUTLOOK 2003 Outlook VBA and Custom Forms 1
P replace default outlook form with custom form Outlook VBA and Custom Forms 1
A How to replace getcontactsfolder (ol2007) in Outlook 2003 Outlook VBA and Custom Forms 2
N How to delete default folder "Contacts" (olFolderContacts) in a .pst file Using Outlook 8
sahameed82 SharePoint calendar directly open in Outlook Using Outlook 0
F Sharepoint tasks from multiple accounts in To-Do List Using Outlook 8
Diane Poremsky Goodbye, SharePoint Social Connector Using Outlook 0
J Outlook Macro to Update Sharepoint Excel File Using Outlook 1
A Need to view Outlook calendar in Sharepoint .. Using Outlook 2
M Map Outlook user defined fields onto a Sharepoint list ??? Outlook VBA and Custom Forms 1
A Adding a 2010 sharepoint contact list to outlook 2010 address book Using Outlook 1
F Sync Sharepoint Calendar With Personal Calendar Outlook VBA and Custom Forms 5
Marcy Outlook and SharePoint 2013 - Syncing Contacts Using Outlook 2
Paul Butticaz Copying Contacts from SharePoint List (connected to Outlook) to another Conacts folder Using Outlook 1
Stefanos Update Sharepoint tasks through Outlook Using Outlook 2
P Task not visible in SharePoint Using Outlook 5
P Task in SharePoint-list not visible to colleagues Using Outlook 1
M Import distribution list into MS Exchange Sharepoint Exchange Server Administration 3
P Using BCM2010 Business Projects as SharePoint 2007 Data Source BCM (Business Contact Manager) 3
J Sharepoint and BCM BCM (Business Contact Manager) 1
S Display SharePoint document library in a customized Outlook form Outlook VBA and Custom Forms 1

Similar threads

Top