|
2.7. Add Users and PermissionsIf 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 itSharePoint 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 formFigure 2-13. SharePoint creates accounts and notifies new members
2.7.2. How it worksSharePoint 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...
|
|