Bertling
asked on
Script to delete outlook contacts container
Hi there,
probably a easy one but can anyone advise a script that would delete a sub-contacts container in the outlooks default "Contacts" container called "BB Contacts".
FYI It is outlook 2010 which we use.
thanks,
mike
probably a easy one but can anyone advise a script that would delete a sub-contacts container in the outlooks default "Contacts" container called "BB Contacts".
FYI It is outlook 2010 which we use.
thanks,
mike
Note in the VBS context then application is replaced by a declaration to outlook for example:
set olkAPp = createobject("outlook.appl ication")
olkapp.Session.GetDefaultF older(10). Folders("b b contacts").delete
Chris
set olkAPp = createobject("outlook.appl
olkapp.Session.GetDefaultF
Chris
ASKER
hi thanks for this.
i created a VBS with the following code:
set olkAPp = createobject("outlook.appl ication")
olkapp.Session.GetDefaultF older(10). Folders("b b contacts").delete
and it errors "The attempt operation failed. and object could not be...."
if you could kindly advise what i need to paste int othe vbs that would be great.
thanks again,
mike
i created a VBS with the following code:
set olkAPp = createobject("outlook.appl
olkapp.Session.GetDefaultF
and it errors "The attempt operation failed. and object could not be...."
if you could kindly advise what i need to paste int othe vbs that would be great.
thanks again,
mike
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
For eample in outlook itself set the cursor onto the folder then in the VBE type:
msgbox application.ActiveExplorer .CurrentFo lder.Folde rPath
What does it show?
msgbox application.ActiveExplorer
What does it show?
Got to go but if it's at the same level then try:
Set olkapp = CreateObject("outlook.appl ication")
olkapp.Session.GetDefaultF older(10). parent.Fol ders("bb contacts").Delete
Set olkapp = CreateObject("outlook.appl
olkapp.Session.GetDefaultF
ASKER
Hi Chris,
that is great you were right sorry for my mistake in missing the s off the end of the sub container.
the next thing i have noticed is that it will put it into the deleted items. is it possible to permanently delete it? it may need to be deleted in the same way but then instead under the "Deleted Items" container...
thanks,
mike
that is great you were right sorry for my mistake in missing the s off the end of the sub container.
the next thing i have noticed is that it will put it into the deleted items. is it possible to permanently delete it? it may need to be deleted in the same way but then instead under the "Deleted Items" container...
thanks,
mike
SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER
thanks for your help guys it works a treat!
Welcome, Chris is good.
~bp
~bp
application.Session.GetDef
Chris