Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > VB Script

Vista - Script to create "My SharePoint Sites"

Reply
 
Old 02-17-2009   #1 (permalink)
Doug


 
 

Script to create "My SharePoint Sites"

This script was created for a specific purpose...so there are some shortcuts
that may not be applicable in all situations. It is a bit of a hack, but I
couldn't find any way to automatically roll this out to all users within an
organization. Individually, users can set this up themselves by creating a My
Site in MOSS and clicking Yes on the dialogue that asks if they want to
integrate with Microsoft Office.

It is meant to be rolled out en masse to users of a particuler MOSS 2007
document library. It is assumed that the users all have Office 2007 installed
and they have access to the document library.

Once this script is run for a particular user (it can be added to AD logon
scripts), the user will have a "My SharePoint Sites" folder in the Save or
Save As dialogues of any Microsoft Office Application with a browser view of
the document library.

This script does a couple of things:
-- Creates a Link Folder in the My SharePoint Sites folder for Office 2007
-- Adds the necessary registry keys to let Office know that a My SharePoint
Sites folder exists.
--


Option Explicit
Dim objFSO, objWSHShell
Const NETHOOD = &H13&

'Create the FileSystemObject and the Windows Scripting Shell
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objWSHShell = CreateObject("Wscript.Shell")

'Setup the file path variables
Dim sTargetPath, sFolderPath, spFolderPath

'sTargetPath is the local path to the sharepoint folder that you want to
show up in My SharePoint Sites
sTargetPath = "{fill in your sharepoint path here}"

'SFolderPath is the path to the folder as you want it to appear to the user
in My SharePoint Sites
sFolderPath = objWSHShell.Environment("PROCESS")("UserProfile") & "\Local
Settings\Application Data\Microsoft\Office\My SharePoint Sites" & "\" &
"{Fill in Name Here}"

'spFolderPath is the location of the SharePoint folder for Microsoft Office
spFolderPath = objWSHShell.Environment("PROCESS")("UserProfile") & "\Local
Settings\Application Data\Microsoft\Office\My SharePoint Sites"

'Calls the subroutine that does the work
CreateNetworkPlace sTargetPath, sFolderPath, spFolderPath

Sub CreateNetworkPlace(sTargetPath, sFolderPath, spFolderPath)
Dim oShortcut, oTextFile, objFSOFolder

'If the sharepoint folder does not exist, then create it
if NOT objFSO.FolderExists(spFolderPath) Then
Set objFSOFolder = objFSO.CreateFolder(spFolderPath)
objFSOFolder.Attributes = 1

Set oTextFile = objFSOFolder.CreateTextFile("Desktop.ini", True)
oTextFile.WriteLine "[.ShellClassInfo]"
oTextFile.WriteLine "IconIndex=0"
oTextFile.WriteLine "Flags=2"
oTextFile.WriteLine "IconFile=" &
objWSHShell.Environment("PROCESS")("AllUsersProfile") & "\Application
Data\Microsoft\Office\MySharePoints.ico"
oTextFile.Close
End If

'Delete the sFolderPath if it already exists. We are going to recreate it
if objFSO.FolderExists(sFolderPath) Then
objFSO.DeleteFolder sFolderPath, True
End If

'Create the sFolderPath and make it readonly
Set objFSOFolder = objFSO.CreateFolder(sFolderPath)
objFSOFolder.Attributes = 1

'Need to create a target.lnk shortcut that tells the sFolderPath how to get
to the sharepoint site
Set oShortcut = objWSHShell.CreateShortcut(objFSOFolder.Path &
"\target.lnk")
oShortcut.TargetPath = sTargetPath
oShortcut.IconLocation = "%SystemRoot%\system32\SHELL32.DLL, 85"
oShortcut.Description = "Icon Master Content Repository"
oShortcut.WorkingDirectory = sTargetPath
oShortcut.WindowStyle = 1
oShortcut.Save

'The Desktop.ini class id denotes this folder as a shortcut folder
Set oTextFile = objFSOFolder.CreateTextFile("Desktop.ini", True)
oTextFile.WriteLine "[.ShellClassInfo]"
oTextFile.WriteLine "CLSID2={0AFACED1-E828-11D1-9187-B532F1E9575D}"
oTextFile.WriteLine "Flags=2"
oTextFile.WriteLine "ConfirmFileOp=0"
oTextFile.Close

'Create the registry key for Microsoft Office
objWSHShell.RegWrite
"HKEY_CURRENT_USER\Software\Microsoft\Office\12.0\Common\Portal\PersonalSiteURL",sTargetPath,"REG_SZ"
End Sub

--
Doug

My System SpecsSystem Spec
Old 02-17-2009   #2 (permalink)
Al Dunbar


 
 

Re: Script to create "My SharePoint Sites"


"Doug" <Doug@xxxxxx> wrote in message
news:C66D778E-C058-47C3-922E-4108C15BB286@xxxxxx
Quote:

> This script was created for a specific purpose...so there are some
> shortcuts
> that may not be applicable in all situations. It is a bit of a hack, but I
> couldn't find any way to automatically roll this out to all users within
> an
> organization. Individually, users can set this up themselves by creating a
> My
> Site in MOSS and clicking Yes on the dialogue that asks if they want to
> integrate with Microsoft Office.
>
> It is meant to be rolled out en masse to users of a particuler MOSS 2007
> document library. It is assumed that the users all have Office 2007
> installed
> and they have access to the document library.
>
> Once this script is run for a particular user (it can be added to AD logon
> scripts), the user will have a "My SharePoint Sites" folder in the Save or
> Save As dialogues of any Microsoft Office Application with a browser view
> of
> the document library.
>
> This script does a couple of things:
> -- Creates a Link Folder in the My SharePoint Sites folder for Office 2007
> -- Adds the necessary registry keys to let Office know that a My
> SharePoint
> Sites folder exists.
> --
Do you have a question?

/Al
Quote:

> Option Explicit
> Dim objFSO, objWSHShell
> Const NETHOOD = &H13&
>
> 'Create the FileSystemObject and the Windows Scripting Shell
> Set objFSO = CreateObject("Scripting.FileSystemObject")
> Set objWSHShell = CreateObject("Wscript.Shell")
>
> 'Setup the file path variables
> Dim sTargetPath, sFolderPath, spFolderPath
>
> 'sTargetPath is the local path to the sharepoint folder that you want to
> show up in My SharePoint Sites
> sTargetPath = "{fill in your sharepoint path here}"
>
> 'SFolderPath is the path to the folder as you want it to appear to the
> user
> in My SharePoint Sites
> sFolderPath = objWSHShell.Environment("PROCESS")("UserProfile") & "\Local
> Settings\Application Data\Microsoft\Office\My SharePoint Sites" & "\" &
> "{Fill in Name Here}"
>
> 'spFolderPath is the location of the SharePoint folder for Microsoft
> Office
> spFolderPath = objWSHShell.Environment("PROCESS")("UserProfile") & "\Local
> Settings\Application Data\Microsoft\Office\My SharePoint Sites"
>
> 'Calls the subroutine that does the work
> CreateNetworkPlace sTargetPath, sFolderPath, spFolderPath
>
> Sub CreateNetworkPlace(sTargetPath, sFolderPath, spFolderPath)
> Dim oShortcut, oTextFile, objFSOFolder
>
> 'If the sharepoint folder does not exist, then create it
> if NOT objFSO.FolderExists(spFolderPath) Then
> Set objFSOFolder = objFSO.CreateFolder(spFolderPath)
> objFSOFolder.Attributes = 1
>
> Set oTextFile = objFSOFolder.CreateTextFile("Desktop.ini", True)
> oTextFile.WriteLine "[.ShellClassInfo]"
> oTextFile.WriteLine "IconIndex=0"
> oTextFile.WriteLine "Flags=2"
> oTextFile.WriteLine "IconFile=" &
> objWSHShell.Environment("PROCESS")("AllUsersProfile") & "\Application
> Data\Microsoft\Office\MySharePoints.ico"
> oTextFile.Close
> End If
>
> 'Delete the sFolderPath if it already exists. We are going to recreate it
> if objFSO.FolderExists(sFolderPath) Then
> objFSO.DeleteFolder sFolderPath, True
> End If
>
> 'Create the sFolderPath and make it readonly
> Set objFSOFolder = objFSO.CreateFolder(sFolderPath)
> objFSOFolder.Attributes = 1
>
> 'Need to create a target.lnk shortcut that tells the sFolderPath how to
> get
> to the sharepoint site
> Set oShortcut = objWSHShell.CreateShortcut(objFSOFolder.Path &
> "\target.lnk")
> oShortcut.TargetPath = sTargetPath
> oShortcut.IconLocation = "%SystemRoot%\system32\SHELL32.DLL, 85"
> oShortcut.Description = "Icon Master Content Repository"
> oShortcut.WorkingDirectory = sTargetPath
> oShortcut.WindowStyle = 1
> oShortcut.Save
>
> 'The Desktop.ini class id denotes this folder as a shortcut folder
> Set oTextFile = objFSOFolder.CreateTextFile("Desktop.ini", True)
> oTextFile.WriteLine "[.ShellClassInfo]"
> oTextFile.WriteLine "CLSID2={0AFACED1-E828-11D1-9187-B532F1E9575D}"
> oTextFile.WriteLine "Flags=2"
> oTextFile.WriteLine "ConfirmFileOp=0"
> oTextFile.Close
>
> 'Create the registry key for Microsoft Office
> objWSHShell.RegWrite
> "HKEY_CURRENT_USER\Software\Microsoft\Office\12.0\Common\Portal\PersonalSiteURL",sTargetPath,"REG_SZ"
> End Sub
>
> --
> Doug

My System SpecsSystem Spec
Old 02-18-2009   #3 (permalink)
Doug


 
 

Re: Script to create "My SharePoint Sites"

Nope, just sharing...this post is marked as a general comment.
--
Doug


"Al Dunbar" wrote:
Quote:

>
> "Doug" <Doug@xxxxxx> wrote in message
> news:C66D778E-C058-47C3-922E-4108C15BB286@xxxxxx
Quote:

> > This script was created for a specific purpose...so there are some
> > shortcuts
> > that may not be applicable in all situations. It is a bit of a hack, but I
> > couldn't find any way to automatically roll this out to all users within
> > an
> > organization. Individually, users can set this up themselves by creating a
> > My
> > Site in MOSS and clicking Yes on the dialogue that asks if they want to
> > integrate with Microsoft Office.
> >
> > It is meant to be rolled out en masse to users of a particuler MOSS 2007
> > document library. It is assumed that the users all have Office 2007
> > installed
> > and they have access to the document library.
> >
> > Once this script is run for a particular user (it can be added to AD logon
> > scripts), the user will have a "My SharePoint Sites" folder in the Save or
> > Save As dialogues of any Microsoft Office Application with a browser view
> > of
> > the document library.
> >
> > This script does a couple of things:
> > -- Creates a Link Folder in the My SharePoint Sites folder for Office 2007
> > -- Adds the necessary registry keys to let Office know that a My
> > SharePoint
> > Sites folder exists.
> > --
>
> Do you have a question?
>
> /Al
>
Quote:

> > Option Explicit
> > Dim objFSO, objWSHShell
> > Const NETHOOD = &H13&
> >
> > 'Create the FileSystemObject and the Windows Scripting Shell
> > Set objFSO = CreateObject("Scripting.FileSystemObject")
> > Set objWSHShell = CreateObject("Wscript.Shell")
> >
> > 'Setup the file path variables
> > Dim sTargetPath, sFolderPath, spFolderPath
> >
> > 'sTargetPath is the local path to the sharepoint folder that you want to
> > show up in My SharePoint Sites
> > sTargetPath = "{fill in your sharepoint path here}"
> >
> > 'SFolderPath is the path to the folder as you want it to appear to the
> > user
> > in My SharePoint Sites
> > sFolderPath = objWSHShell.Environment("PROCESS")("UserProfile") & "\Local
> > Settings\Application Data\Microsoft\Office\My SharePoint Sites" & "\" &
> > "{Fill in Name Here}"
> >
> > 'spFolderPath is the location of the SharePoint folder for Microsoft
> > Office
> > spFolderPath = objWSHShell.Environment("PROCESS")("UserProfile") & "\Local
> > Settings\Application Data\Microsoft\Office\My SharePoint Sites"
> >
> > 'Calls the subroutine that does the work
> > CreateNetworkPlace sTargetPath, sFolderPath, spFolderPath
> >
> > Sub CreateNetworkPlace(sTargetPath, sFolderPath, spFolderPath)
> > Dim oShortcut, oTextFile, objFSOFolder
> >
> > 'If the sharepoint folder does not exist, then create it
> > if NOT objFSO.FolderExists(spFolderPath) Then
> > Set objFSOFolder = objFSO.CreateFolder(spFolderPath)
> > objFSOFolder.Attributes = 1
> >
> > Set oTextFile = objFSOFolder.CreateTextFile("Desktop.ini", True)
> > oTextFile.WriteLine "[.ShellClassInfo]"
> > oTextFile.WriteLine "IconIndex=0"
> > oTextFile.WriteLine "Flags=2"
> > oTextFile.WriteLine "IconFile=" &
> > objWSHShell.Environment("PROCESS")("AllUsersProfile") & "\Application
> > Data\Microsoft\Office\MySharePoints.ico"
> > oTextFile.Close
> > End If
> >
> > 'Delete the sFolderPath if it already exists. We are going to recreate it
> > if objFSO.FolderExists(sFolderPath) Then
> > objFSO.DeleteFolder sFolderPath, True
> > End If
> >
> > 'Create the sFolderPath and make it readonly
> > Set objFSOFolder = objFSO.CreateFolder(sFolderPath)
> > objFSOFolder.Attributes = 1
> >
> > 'Need to create a target.lnk shortcut that tells the sFolderPath how to
> > get
> > to the sharepoint site
> > Set oShortcut = objWSHShell.CreateShortcut(objFSOFolder.Path &
> > "\target.lnk")
> > oShortcut.TargetPath = sTargetPath
> > oShortcut.IconLocation = "%SystemRoot%\system32\SHELL32.DLL, 85"
> > oShortcut.Description = "Icon Master Content Repository"
> > oShortcut.WorkingDirectory = sTargetPath
> > oShortcut.WindowStyle = 1
> > oShortcut.Save
> >
> > 'The Desktop.ini class id denotes this folder as a shortcut folder
> > Set oTextFile = objFSOFolder.CreateTextFile("Desktop.ini", True)
> > oTextFile.WriteLine "[.ShellClassInfo]"
> > oTextFile.WriteLine "CLSID2={0AFACED1-E828-11D1-9187-B532F1E9575D}"
> > oTextFile.WriteLine "Flags=2"
> > oTextFile.WriteLine "ConfirmFileOp=0"
> > oTextFile.Close
> >
> > 'Create the registry key for Microsoft Office
> > objWSHShell.RegWrite
> > "HKEY_CURRENT_USER\Software\Microsoft\Office\12.0\Common\Portal\PersonalSiteURL",sTargetPath,"REG_SZ"
> > End Sub
> >
> > --
> > Doug
>
>
>
My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Help! Vista Cannot create dialup/VPN connections "The wizard cannot create the connection" Vista networking & sharing
do not display "ERRORS" when running script without using $erroractionpreference = "SilentlyContinue" PowerShell
"Parameter is incorrect" for SOME file copy SharePoint to Vista NO Vista General
Should "script" be listed as a "reserved word" PowerShell
Longhorn Beta2: Error on adding Role "Windows Sharepoint Services" Vista installation & setup


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46