by Victor
2. August 2011 17:37
Every day, a small Ant arrived at work early and started work immediately. She produced a lot and she was happy. The boss, a lion, was surprised to see that the ant was working without supervision. He thought if the ant can produce so much without supervision, wouldn’t she produce more if she had a supervisor!
So the lion recruited a cockroach who had extensive experience as a supervisor and who was famous for writing excellent reports. The cockroach’s first decision was to set up a “clocking in” attendance system. He also needed a secretary to help him write and type his reports. He recruited a spider that managed the archives and monitored all phone calls.
The lion was delighted with the cockroach’s report and asked him to produce graphs to describe production rates and analyze, trends so that he could use them for presentations at board meetings, so the cockroach had to buy a new computer and a laser printer and recruit a fly to manage the It department. The Ant, who had been once so productive and relaxed, hated the plethora of paperwork and meetings which used up most of her time.
The lion came to the conclusion that it was high time to nominate a person in charge of the department where the ant worked. The position was given to the Cicada whose first decision was to buy a carpet and an ergonomic chair for his office. The cicada also needed a computer and a personal assistant, who he had brought form his previous department. To help him prepare a work and budget control strategic optimization plan.
The department where the ant works is now a sad place, where nobody laughs anymore and everybody has become upset. It was at that time the cicada convinced the boss, the Lion to start a climate study of the environment. Having reviewed the charges of running the ants department the lion found out that the production was much less than before, so he recruited the Owl, a prestigious and renowned consultant to carry out an audit and suggest solutions. The owl spent 3 months in the department and came out with an enormous report, in several volumes, That concluded that ” The Department is overstaffed!”
Guess who the lion fired first?
The Ant of course, because everyone superior to the Ant blamed her, the worker.
b0c385bf-d97c-4d34-96ae-2d76e0e7638a|0|.0
Tags:
by Victor
26. March 2011 00:46
If you ever want to search something from the database but you don't know which tables to search from, here is the query you need:
/****** Script for SelectTopNRows command from SSMS ******/
SET NOCOUNT ON
DECLARE
@TotalRows int,
@Counter int,
@TableName varchar(50),
@ColumnName varchar(50),
@FieldValue varchar(250),
@SQLCommand nvarchar(1000),
@ValueToFind varchar(100)
SET @ValueToFind = 'VAULE TO SEARCH'
DECLARE @MyTable table
( RowID int IDENTITY,
TableName varchar(50),
ColumnName varchar(50)
)
CREATE TABLE #FoundTable
( RowID int IDENTITY,
Tablename varchar(50)
)
INSERT INTO @MyTable
SELECT
TABLE_NAME,
COLUMN_NAME
FROM INFORMATION_SCHEMA.COLUMNS
WHERE DATA_TYPE IN ( 'char', 'varchar', 'nchar', 'nvarchar', 'text', 'ntext' )
SELECT
@TotalRows = @@ROWCOUNT,
@Counter = 1
WHILE ( @Counter <= @TotalRows )
BEGIN
SELECT
@TableName = TableName,
@ColumnName = ColumnName
FROM @MyTable
WHERE RowID = @Counter
SET @SQLCommand = 'IF EXISTS ( ' +
'SELECT 1 FROM [' + @TableName + '] WHERE [' + @ColumnName + '] LIKE ''%' + @ValueToFind + '%'' ' +
' )' +
'INSERT INTO #FoundTable ' +
' SELECT ''' + @TableName + '(' + @ColumnName + ')'''
EXECUTE sp_executesql @SQLCommand
SET @Counter = ( @Counter + 1 )
END
SELECT * FROM #FoundTable
DROP TABLE #FoundTable
42ec6d68-6d7d-49d0-9a49-64e039cccb2e|0|.0
Tags:
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.
