by Victor
23. June 2010 21:43
SPSecurityTrimmedControl is a useful SharePoint control to control the visibility of content and controls on your site. In order to use this control, simply add the following code into your page:
<SharePoint:SPSecurityTrimmedControl runat="server" PermissionsString="ManageLists">
Your code here.
</SharePoint:SPSecurityTrimmedControl>
The list of the permissions is:
|
Member name
|
Description
|
|
EmptyMask
|
Has no permissions on the Web site. Not available through the user interface.
|
|
ViewListItems
|
View items in lists, documents in document libraries, and view Web discussion
comments.
|
|
AddListItems
|
Add items to lists, add documents to document libraries, and add Web discussion
comments.
|
|
EditListItems
|
Edit items in lists, edit documents in document libraries, edit Web discussion
comments in documents, and customize Web Part Pages in document libraries.
|
|
DeleteListItems
|
Delete items from a list, documents from a document library, and Web discussion
comments in documents.
|
|
ApproveItems
|
Approve a minor version of a list item or document.
|
|
OpenItems
|
View the source of documents with server-side file handlers.
|
|
ViewVersions
|
View past versions of a list item or document.
|
|
DeleteVersions
|
Delete past versions of a list item or document.
|
|
CancelCheckout
|
Discard or check in a document which is checked out to another user.
|
|
ManagePersonalViews
|
Create, change, and delete personal views of lists.
|
|
ManageLists
|
Create and delete lists, add or remove columns in a list, and add or remove
public views of a list.
|
|
ViewFormPages
|
View forms, views, and application pages, and enumerate lists.
|
|
Open
|
Allow users to open a Web site, list, or folder to access items inside that
container.
|
|
ViewPages
|
View pages in a Web site.
|
|
AddAndCustomizePages
|
Add, change, or delete HTML pages or Web Part Pages, and edit the Web site using
a SharePoint Foundation–compatible editor.
|
|
ApplyThemeAndBorder
|
Apply a theme or borders to the entire Web site.
|
|
ApplyStyleSheets
|
Apply a style sheet (.css file) to the Web site.
|
|
ViewUsageData
|
View reports on Web site usage.
|
|
CreateSSCSite
|
Create a Web site using Self-Service Site Creation.
|
|
ManageSubwebs
|
Create subsites such as team sites, Meeting Workspace sites, and Document Workspace
sites.
|
|
CreateGroups
|
Create a group of users that can be used anywhere within the site collection.
|
|
ManagePermissions
|
Create and change permission levels on the Web site and assign permissions to
users and groups.
|
|
BrowseDirectories
|
Enumerate files and folders in a Web site using Microsoft Office SharePoint
Designer 2007 and WebDAV interfaces.
|
|
BrowseUserInfo
|
View information about users of the Web site.
|
|
AddDelPrivateWebParts
|
Add or remove personal Web Parts on a Web Part Page.
|
|
UpdatePersonalWebParts
|
Update Web Parts to display personalized information.
|
|
ManageWeb
|
Grant the ability to perform all administration tasks for the Web site as well
as manage content. Activate, deactivate, or edit properties of Web site scoped Features
through the object model or through the user interface (UI). When granted on the
root Web site of a site collection, activate, deactivate, or edit properties of
site collection scoped Features through the object model. To browse to the Site Collection Features page and activate or deactivate
site collection scoped Features through the UI, you must be a site collection administrator.
|
|
UseClientIntegration
|
Use features that launch client applications; otherwise, users must work on
documents locally and upload changes.
|
|
UseRemoteAPIs
|
Use SOAP, WebDAV, or Microsoft Office SharePoint Designer 2007 interfaces to
access the Web site.
|
|
ManageAlerts
|
Manage alerts for all users of the Web site.
|
|
CreateAlerts
|
Create e-mail alerts.
|
|
EditMyUserInfo
|
Allows a user to change his or her user information, such as adding a picture.
|
|
EnumeratePermissions
|
Enumerate permissions on the Web site, list, folder, document, or list item.
|
|
FullMask
|
Has all permissions on the Web site. Not available through the user interface.
|
by Victor
15. June 2010 22:24
1. Create a project (It seems .net 4 doesn't work well with SharePoint 2007)
2. Add the reference to Microsoft.Office.Server.dll. (C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\ISAPI)
3. The log code looks like this.
try
{
throw new Exception("This is a test");
}
catch (Exception ex)
{
Microsoft.Office.Server.Diagnostics.PortalLog.LogString(ex.Message, null);
}
Done
by Victor
10. June 2010 22:36
I find this Post from Dave Wollerman's blog. I think it is very useful to me. Here is the link SharePoint 2007 Single Sign-On Setup
by Victor
9. June 2010 23:00
Here is the step you need to do in order to config your SharePoint site using form authentication.
Preparation: You should have a existing ASP.net 2.0 membership database. Here is the link about how to create this database.
There is a existing user testAdmin already created in the membership database.
SQLConnectString in web.config:
<connectionStrings>
<add name="ApplicationServices" connectionString="Data Source=localhost;User ID=sqluser;Password=Password1;persist security info=False;initial catalog=DemoUser;" providerName="System.Data.SqlClient" />
</connectionStrings>
Membership Configuration Section in web.config:
<membership>
<providers>
<clear/>
<add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="ApplicationServices"
enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false"
maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10"
applicationName="/" />
</providers>
</membership>
Step 1. Create a web application and a site collection.
1. Open the SharePoint Central Administration site.
2. Click Application Management tab.
3. Click Create or extend Web application
4. Click Create a new Web Application
5. In the Port textbox, put the port number you want. I am going to use Port 112 in this example.
6. Under "Allow anonymous", Click "Yes".
7. Click Ok.
8. After you get the information says the web application has been successfully create. Click the "Create Site Collection". I am going to create a publishing portal in this example.
9. Enter the site title. For site template, select the "Publishing Portal" under the Publishing tab.
10. Click Ok.
Step 2.
1. Open the site we just create. In this example it will be http://localhost:112.
2. Click the "Enable anonymous access" link in my front page.

3. Click "Entire Web Site".

Step 3. Change the SharePoint authentication method
1. Open the SharePoint Central Administration Site.
2. Click the "Application Management" Tab.
3. Click the "Authentication Providers" under the "Application Security" section.

4. Confirm the web application you want to modify is correct. In this case http://localhost:112
5. Click the Default
6. Change the Authentication Type to "Forms"
7. Set the Membership Provider Name to "AspNetSqlMembershipProvider"
8. Set the Role Manager Name to "AspNetSqlRoleProvider"

9. Click Save.
Step 4 This is step is optional. You only need to do this if you want to set users from your membership database as your site collection administrators.
1. Open the web.config file for your Central Administration. The file is located in "C:\Inetpub\wwwroot\wss\VirtualDirectories\PortNumber" - PortNumber is the port number for your Central Administration site.
2. Add the SQLConnectString and Membership Configuration Section in the web.config.
3. Save and close your web.config file.
4. Open the SharePoint Central Administration Site.
5. Click the "Application Management" Tab.
6. Click "Site Collection Administrators" under the "SharePoint Site Management" Section.
7. Confirm the site collection you want to modify is correct. In this case http://localhost:112
8. For primary site collection administrator type "test" and verify user. It may take a few seconds, but the page should underline the text in the textbox indicating that the username is valid.
9. Click Ok.
Now if you open the SharePoint site, you should able to see a "Sign In" link at the top of you screen.

Click that link you will able to see your login screen.

Then the screen should look like this. If you configure the step 4, you should be able to see the "Site Actions" menus as well.

by Victor
8. June 2010 23:11
Aspnet_regsql.exe is a tool for installing the SQL Server database used by the SQL Server providers. The file is located in the "c:\WINDOWS\Microsoft.NET\Framework\versionNumber folder" on your web server. There are too ways to run this tool: the wizard form and the command line.
1. To run this using wizard is very simple.
Step 1: Run the aspnet_regsql.exe from your command line without any arguments. Then the wizard windows form will appear. Click the Next Button.

Step 2: Choose what you want to do with the sql database. In this example we want to create a new application services database. So we just select the first option then Click the Next Button.

Step 3: Enter your sql server name, authentication method and the database name. If the database has already existed, you can select the dropdownlist. If the database is new, you only need to type in the new database name in the dropdownlist. Click the Next Button.

Step 4: Confirm the information then then Click the Next Button.

Step 5: Done.

After that your database should be created. And it should look likes this.

2. Also you can run the tool as a command-line utility. The options for the command are
|
Option
|
Description
|
|
-?
|
Prints Aspnet_regsql.exe tool Help text in the command window.
|
|
-W
|
Runs the tool in wizard mode. This is the default if no command line arguments are specified.
|
|
-C connection string |
The connection string to the computer running SQL Server where the database will be installed, or is already installed. This option is not necessary if you only specify the server (-S) and login (-U and -P, or -E) information. |
|
-S server |
The name of the computer running SQL Server where the database will be installed, or is already installed. The server name can also include an instance name, such as .\INSTANCENAME. |
|
-U login id |
The SQL Server user id to log in with. This option also requires the password (-P) option. This option is not necessary if you are authenticating using Windows credentials (-E). |
|
-P password |
The SQL Server password to log in with. This option also requires the login id (-U) option. This option is not necessary if authenticating using Windows credentials (-E). |
|
-E |
Authenticates using the Windows credentials of the currently logged-in user. |
|
-d database |
The name of the database to create or modify. If the database is not specified, the default database name of "aspnetdb" is used. |
|
-sqlexportonly filename |
Generates a SQL script file that can be used to add or remove the specified features. The specified actions are not performed. |
|
-A all|m|r|p|c|w |
Adds support for one or more features. The following identifiers are used for ASP.NET features.
|
all |
All features |
|
m |
Membership |
|
r |
Role management |
|
p |
Profile |
|
c |
Web Parts personalization |
|
w |
Web events |
Feature identifiers can be specified together or separately, as shown in the following examples.
aspnet_regsql.exe -E -S localhost -A mp
aspnet_regsql.exe -E -S localhost -A m -A p |
|
-R all|m|r|p|c|w |
Removes support for one or more features. The identifiers are the same for the add option..
Here is some examples.
aspnet_regsql.exe -E -S localhost -R mp
aspnet_regsql.exe -E -S localhost -R m -R p |
|
-Q |
Runs the tool in quiet mode and does not confirm before removing a feature. |
So if you want to add database elements for membership and role management in database test on localhost using the current windows user. The command should be:
aspnet_regsql.exe -E -S localhost -d test -A mr