Section 2.7.Add Users and Permissions


2.7. Add Users and Permissions

If you read the previous topic, you saw sample code using the Members collection, but so far we haven't added any members to the workspace. The user who creates the workspace is automatically a member, of course, but you can add other members and set their permissions either through the SharePoint site, through the Excel task pane, or through code.

2.7.1. How to do it

SharePoint provides an easy-to-use interface for adding users and setting permissions, as shown in Figures 2-12 and 2-13.

Excel provides a similar interface if you click Add new member on the Shared Workspace task pane. To add users from code, use the Members collection's Add method:

    Set sw = ThisWorkbook.SharedWorkspace    If sw.Connected Then        sw.Members.Add "ExcelDemo@hotmail.com", "APPTIX\ExcelDemo", _    "Contributor"    End If

The last argument of the Add method sets the users' permissions, as shown in the following table.

Figure 2-12. Click Add new member and SharePoint displays this form


Figure 2-13. SharePoint creates accounts and notifies new members


SettingPermission

Guest

No access by default, but can be granted access to specific items.

Reader

Read-only access to the site.

Contributor

Add content to existing document libraries and lists.

Web designer

Create lists and document libraries and customize pages in the site.

Administrator

Full control of the site.


2.7.2. How it works

SharePoint uses Windows authentication to validate users. That means a user must first have a Windows account on the server (or on the network) before she can be added to a SharePoint site. In the case of a hosted service, such as a free trial account, SharePoint automatically creates a Windows account whenever it receives a request to add a new member, then the SharePoint site adds that member to the workspace.

Automatic account creation is also available if you installed SharePoint on your own server, but it must be configured during installation, and you must be using Active Directory on your server. If you don't configure auto accounts, you must create Windows accounts for new user, before you can add those users as members to a site. In a corporate environment, users may already have network accounts that the server can validatein those cases, you won't have to create Windows accounts.

SharePoint uses Windows authentication to allow access to the site, but once access is granted, SharePoint authorizes members based on their permissions within the site. Membership and permissions are organized by folder, so all members may have access to the site homepage, several members may have access to the /ch02 workspace, a different set of members may have access to /ch03, and so on.

This system of organizing access by folder is part of the .NET security architecture, and it is the reason Excel creates a new workspace folder whenever you select Tools Share Workspace from a workbook.

2.7.3. What about...

To learn how toLook here

Configure SharePoint Services to use Kerberos authentication

support.microsoft.com/default.aspx?scid=kb;en-us;832769




    Excel 2003 Programming. A Developer's Notebook
    Excel 2003 Programming: A Developers Notebook (Developers Notebook)
    ISBN: 0596007671
    EAN: 2147483647
    Year: 2004
    Pages: 133
    Authors: Jeff Webb

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net