다음을 통해 공유


Extending the Connect To Control

Applies to: SharePoint Foundation 2010

The "Connect To…" menu item is extensible so that any client can make use of it.

How do you connect the Connect To menu item? Create your ActiveX control and then let the menu know its there.

Extending the Connect To menu item

Client applications must perform two steps in order for the menu item to be displayed:

  1. Register the Stssync Protocol protocol handler. The stssync protocol enables you to add an Events list or a Contacts list that exists on a SharePoint Foundation site to Office Outlook 2003, Office Outlook 2007, or to a third-party application that supports the protocol.

  2. Install an ActiveX control that returns the application name and an icon file name.

The ActiveX control must have a ProgID of SharePoint.Stssynchandler.3 and it must implement the following methods:

HRESULT GetStssyncAppNameForType([in] BSTR pbstrType,  [out, retval] BSTR *pbstrAppName);
HRESULT GetStssyncIconName([out, retval] BSTR *pbstrIconName);

Before displaying the menu item, SharePoint Foundation calls the GetStssyncAppNameForType() method in the ActiveX control and passes the synchronization type of the current list. Each list has a default synchronization type (accessed in the object model at SPList.SyncType) based on its base type, base template, and whether it allows content types. This type can be overridden as an attribute of the list template definition in a feature.

Typically, the ActiveX control checks the synchronization type against a list of supported types and returns the name of the application where the menu item is displayed, or returns NULL if the type is not supported – in which case the menu item is not displayed.

If a non-null application name is returned, SharePoint Foundation then calls the GetStssyncIconName() method of the control to get the file name of an icon to display in the menu item. The file name returned is used in the context menu for document library folders, while the "menu" prefix is added to the file name to get the image that is used in the toolbar menu item. Thus, clients should install two images in the images path of each SharePoint Foundation Web front-end server. For example, if the filename were'sample' the names would be sample.gif and menusample.gif.

If the browser does not support Active X, the "Connect To…" menu is displayed with a default icon and you can assume that the stssync protocol is supported.

When the button is clicked, JavaScript redirects the browser to an stssync:// URL with the correct context parameters. The URL is formatted as follows:

stssync://sts/?ver=1.1&type=Type&cmd=add-folder&base-url=WebUrl&list-url=ListUrl&guid=ListId&site-name=SiteName&list-name=ListName

Type

Synchronization type for this list

ListId

List identifier, expressed as a GUID.

ListName

Title of the list; maximum length is 20 characters.

ListUrl

A web-relative encoded URL (starting and ending with /) to the list.

SiteName

Title of the Web site where the list is found; maximum length is 20 characters.

ViewUrl

A web-relative encoded URL (starting with /) to the default view page of the list.

WebUrl

An absolute encoded URL to the Web site where the list is found.

Document libraries may add two parameters to the end of the stssync:// URL when syncing a folder:

&folder-url=FolderUrl&folder-id=FolderId

FolderUrlA web-relative, unencoded URL (starting with /) to the context folder

FolderIdThe item ID (an integer) of the context folder

See Also

Concepts

GetListItemChangesSinceToken and Synchronizing Applications

Other Resources

Plan browser support (Windows SharePoint Services)