Thursday, October 23, 2008

Detect, and then delete orphaned items in Windows SharePoint Services content databases

You can use the Stsadm.exe command-line tool with the databaserepair operation to detect, and then delete the following orphaned items in Windows SharePoint Services:
  • A Windows SharePoint Services Web site that does not have a parent Windows SharePoint Services Web site.
  • A subweb that does not have a parent Windows SharePoint Services Web site
  • A list that does not have a parent Windows SharePoint Services Web site
  • A document that does not have a parent document library
  • A list item that does not have a parent list
  • A Web page that does not have a parent Windows SharePoint Services Web site

The databaserepair operation uses the following parameters:

  • Required parameters: url, databasename
  • Optional parameter: deletecorruption

The syntax that the Stsadm.exe command-line tool and the databaserepair operation uses is as follows:

Troubleshooting SharePoint: When Good Servers Go Bad



It summarizes the most-common issues with SharePoint, how to avoid them, and how
to fix them. Here is a list of topics:



  • Install Service Pack 1

  • Runaway Transaction Logs

  • Runaway SharePoint Logs

  • Protected Memory Errors

  • IISWAMREG Admin Service Errors

  • Timer Job Errors

  • Update Conflicts

  • Performance Issues

  • Customization Errors

  • Security Errors



Install Service Pack 1



The first recommendation is to make sure that you have SP1 installed. SP1 has
over 2500 fixes, and can go a long way to helping you avoid issues.



WSS SP1 Download



MOSS SP1 Download





Runaway Transaction Logs



One of the most common issues with SharePoint farms is runaway transaction logs
associated with the SQL Server databases. This is really not a SharePoint issue,
but a SQL Server issue. This issue is caused by the fact that most SharePoint
databases are created in Full-Recovery mode. This means that SQL Server retains
a log of every transaction that occurs on the database since the last database
backup. If you never backup your SharePoint databases, then the transaction log
will continue to grow until all the disk space is used up.



Symptoms



  • Little or no available disk space on SQL Server

  • Huge transaction log files



Recovery



Step 1: Backup the Transaction Log manually from the UI. This will truncate
the log, but not shrink it.



From
http://support.microsoft.com/kb/873235



When the transaction logs grow to an unacceptable limit, you must immediately
back up your transaction log file. While the backup of your transaction log
files is created, SQL Server automatically truncates the inactive part of the
transaction log. The inactive part of the transaction log file contains the
completed transactions, and therefore, the transaction log file is no longer
used by SQL Server during the recovery process. SQL Server reuses this
truncated, inactive space in the transaction log instead of permitting the
transaction log to continue to grow and to use more space.



Step 2: Manually shrink the log file from the UI.



From
http://support.microsoft.com/kb/873235



The backup operation does not reduce the log file size. To reduce the size of
the transaction log file, you must shrink the transaction log file. To shrink a
transaction log file to the requested size and to remove the unused pages, you
must use the DBCC SHRINKFILE operation. The DBCC SHRINKFILE Transact-SQL
statement can only shrink the inactive part inside the log file.



Prevention



Option 1: Switch to Simple recovery Mode for non-production SharePoint
databases.



This will prevent the transaction log from growing because simple recovery mode
does not keep transaction history. Use the following SQL Statement:



USE Master

SELECT Name, Recovery_Model_Desc FROM Sys.Databases



ALTER DATABASE [name] SET RECOVERY SIMPLE WITH NO_WAIT



Option 2: Create a database maintenance plan for all SharePoint databases




Creating the Database Maintenance Plan



1. Open SQL Server Management Studio



2. Right click the SQL Server Agent and select Start from the context menu.



3. Expand the tree and select Management►Maintenance Plans



4. Right click the Maintenance Plans folder and select Maintenance Plan Wizard
from the context menu.



5. On the Welcome screen, click the Next button.



6. On the Select Plan Properties screen, name the plan “MOSS Maintenance”



7. Click the Change button



8. Modify the schedule (daily recommended) and click the OK button.



9. Click the Next button



10. On the Select Maintenance Tasks screen, check the following tasks:



  • Check Database Integrity

  • Reorganize Index

  • Update Statistics

  • Clean Up History

  • Backup Database (Full)



11. Click the Next button.



12. On the Select Maintenance Task Order screen, click the Next button.



13. On the Define Database Check Integrity Task screen, drop the list and select
all of the SharePoint databases.



14. Check the Include Indexes box.



15. Click the Next button.



16. On the Define Reorganize Index Task screen, drop the list and select all of
the SharePoint databases.



17. Check the Compact Large Objects box.



18. Click the Next button.



19. On the Define Update Statistics Task screen, drop the list and select all of
the SharePoint databases.



20. Select the All Existing Statistics option.



21. Select the Full Scan option.



22. Click the Next button.



23. On the Define History Cleanup Task screen, click the Next button.



24. On the Define Back Up Database (Full) Task screen, drop the list and select
all of the SharePoint databases.



25. Check the box titled “Create a subdirectory for each database”.



26. Change the backup location, if desired.



27. Click the Next button.



28. On the Select Report Options screen, click Next.





Creating the Transaction Log Maintenance Plan



If this installation is not a production environment, consider changing the
recovery mode for all databases to SIMPLE using the following

ALTER DATABASE [name] SET RECOVERY SIMPLE WITH NO_WAIT



1. Open SQL Server Management Studio



2. Right click the SQL Server Agent and select Start from the context menu.



3. Expand the tree and select Management►Maintenance Plans



4. Right click the Maintenance Plans folder and select Maintenance Plan Wizard
from the context menu.



5. On the Welcome screen, click the Next button.



6. On the Select Plan Properties screen, name the plan “MOSS Log Maintenance”



7. Click the Change button



8. Under the Frequency section, Select Daily from the Occurs drop-down list



9. Under the Daily frequency section, select the Occurs Every option.



10. Set the Start Time to 9:00:00 AM.



11. Set the End Time to 5:30:00 PM



12. Click the OK button.



13. Click the Next button.



14. On the Select Maintenance Tasks screen, check Backup Database (Transaction
Log)



15. Click the Next button.



16. On the Select Maintenance Task Order screen, click the Next button.



17. On the Define Back Up Database (Transaction Log) Task screen, drop the list
and select all of the SharePoint content databases.



SSP, WSS Search and MOSS Search databases are set to simple recovery model, so
their transaction logs will not grow.



18. Check the box titled “Create a subdirectory for each database”.



19. Change the backup location, if desired.



20. Click the Next button.



21. On the Select Report Options screen, click Next.






Runaway SharePoint Logs



Another area where disk space can be used up quickly is through the SharePoint
Unified Logging Service (ULS). The ULS writes text-file logs to the LOGS folder
in the System Directory (\Program Files\Common Files\Microsoft Shared\web server
extensions\12).



Symptoms



Many large text files located in the LOGS directory



Recovery



Delete old files to regain space as necessary



Prevention





  • Throttle the logging service by opening Central Administration, clicking the
    "Operations" tab and going to "Diagnotic Logging". On the Diagnostic logging
    page, throttle the logged events by selecting a minimum level of severity for
    logging.




  • Make use of the
    LogViewer feature to examine logs. This adds a log
    viewing utility to Central Admin.






Protected Memory Errors



This error shows itself as several different errors in the Event Log all saying
that SharePoint attempted to read or write protected memory.



Symptoms



  • Event Log entries: Attempted to read or write to protected memory

  • Can’t open IIS Manager

  • Can’t make new web applications



Recovery & Prevention






IISWAMREG Admin Service Errors



Symptoms



In the Event Log, you see the following:



Type: Error

Source: DCOM

Category: None

Event ID: 10017

Description:

The application-specific permissions settings do not grant Local Activation
permission for the COM Server application with CLSID {CLSID} to the user
DomainName\UserName SID {SID}. This security permission can be modified using
the Component Services administration tool.



Recovery & Prevention




1. Click Start, click Run, type dcomcnfg in the Open box, and
then click OK.

2. Expand Component Services, expand Computers, expand My
Computer, and then click DCOM Config.

3. Right-click IIS WAMREG admin Service, and then click
Properties.

4. Click the Security tab.

5. Under Launch and Activation Permissions, click Edit.

6. In the Launch Permission dialog box, click Add.

7. In the Select Users, Computers, or Groups dialog box, type
the domain user account that you specified as the Windows SharePoint Services
3.0 service account, click Check Names, and then click OK.

8. In the Permissions for UserName list, click to select the
Allow check box that is next to Local Activation, and then click OK two times.




Here are some additional references:




http://support.microsoft.com/kb/920783




http://blogs.vertigo.com/personal/steventap/Blog/Lists/Posts/Post.aspx?ID=21






Timer Job Errors



There are two timer services in SharePoint that are responsible for running
various jobs that keep the farm healthy. If you have issues with these services,
then you may see these jobs fail.



Symptoms



  • Failed jobs in Central Admin

  • Installed solutions fail to deploy

  • Created web apps fail to create on every server



Recovery



  1. Recycle "Windows SharePoint Services Timer" and "Windows SharePoint Services
    Administration" on every server in the farm.

  2. Run stsadm -o execadmsvcjobs on every server in the
    farm



Prevention



To prevent these issues, create a batch file that periodically recycles the
services.




1. Open NotePad and add the following lines:



NET STOP "Windows SharePoint Services Timer"

NET START "Windows SharePoint Services Timer"

NET STOP "Windows SharePoint Services Administration"

NET START "Windows SharePoint Services Administration"

STSADM -o ExecAdmSvcJobs



2. Save the file as "C:\Program Files\Common Files\Microsoft Shared\web server
extensions\12\ISAPI\RecycleSharePointServiceTimer.bat"

3. Select Control Panel►Scheduled Tasks►Add Scheduled Task.

4. In the Schedule Task Wizard, click the Next button.

5. Click the Browse button and locate the file "C:\Program Files\Common
Files\Microsoft Shared\web server
extensions\12\ISAPI\RecycleSharePointServiceTimer.bat."

6. Select to perform the task daily and click the Next button.

7. Schedule the task to start at 4:00 AM Every Day and click the Next button.

8. Enter credentials for executing the task and click the Next button.

9. Check the box to open the Advanced Properties and click the Finish button.

10. Click the Schedule tab and then click the Advanced button.

11. Check the Repeat Task box.

12. Schedule the task to repeat every 4 hours.

13. Select the Time option and enter 3:00AM.

14. Click the OK button.

15. Click the OK button.






Update Conflicts



Whenever you update SharePoint system passwords, you can have issues with
SharePoint being able to access databases and run jobs.



Symptoms



In the Event Log, you see the following error:



An update conflict has occurred, and you must re-try this action. The object
SPApplicationPool Name=SharePoint Central Administration v3 Parent=SPWebService
Name=WSS_Administration is being updated by {...}, in the STSADM process, on
machine {...}. View the tracing log for more information about the
conflict.



Recovery & Prevention



Clear the File System cache on the SharePoint front end servers using this
procedure: (From
http://support.microsoft.com/kb/939308
).




1. Stop the Timer service. To do this, follow these steps:



a. Click Start, point to Administrative Tools, and then click
Services.


b. Right-click Windows SharePoint Services Timer, and then click
Stop.



2. Delete or move the contents of the following folder:

%ALLUSERSPROFILE% \Application Data\Microsoft\SharePoint\Config\GUID


3. Start the Timer service. To do this, follow these steps:



a. Click Start, point to Administrative Tools, and then click
Services.


b. Right-click Windows SharePoint Services Timer, and then click
Start.




Note The file system cache is re-created after you perform this procedure. Make
sure that you perform this procedure on all servers in the server farm on which
the Timer service is running.




Here's a great article on password changes for SharePoint:

http://blogs.msdn.com/joelo/archive/2006/08/22/712945.aspx






Performance Issues



Various performance issues like slow page loads.



Symptoms



  • Slow Page loads



Recovery



  • Reduce number/complexity of web parts

  • Evaluate lists

  • Evaluate web part architecture



Prevention



  • Control number of web parts

  • Delete unused web parts

  • List Maintenance (2000 Items, Indexed columns)

  • Avoid programming pitfalls (undisposed objects, excessive looping)

  • Enable caching



<BlobCache location="C:\blobCache"
path="\.(gifjpgpngcssjs)$" max enabled="true"
/>





Customization Errors



Symptoms



  • Generic SharePoint Error Page



Recovery



  • Add "?contents=1" to the web of the web page request to open web part management
    page. Delete offending web part

  • Restore default master page if your custom one is causing the problem.

  • Deactivate offending feature

  • Disable custom errors by editing web.config file by making the following
    changes:



<compilation batch="false" debug="true">



<customErrors mode="Off" />



<SafeMode MaxControls="200" CallStack="true" DirectFileDependencies="10"
TotalFileDependencies="50" AllowPageLevelTrace="false">



Prevention



  • Implement a Dev->QA->Production process






Security Errors



Symptoms



Request for the permission of type
'Microsoft.SharePoint.Security.SharePointPermission,
Microsoft.SharePoint.Security, Version=12.0.0.0, Culture=neutral,
PublicKeyToken=71e9bce111e9429c' failed



Recovery



Adjust security policy in web.config file as follows:



<trust level="WSS_Medium"
originUrl="" />



Prevention



Implement custom security policies on all web parts. Start with Dan Larson's
blog entry on the topic.


SharePoint 2007 URL Quick List

The following is a list of SharePoint URLs to get to commonly used administrative functions on a MOSS or WSS v3 site. Not all links listed on this page are accessible to all user levels of a site. This is a quick list for speedy reference as compared to tracking down links through the admin screens or for faster jumping around sites within a site collection.

Add Web Parts Pane
url: ?ToolPaneView=2

Add to the end of the page URL; WILL ONLY WORK IF THE PAGE IS ALREADY CHECKED OUT

Create New Site Content
url: /_layouts/create.aspx

List Template Gallery
url: /_catalogs/lt

Manage Site Collection Administrators
url: /_layouts/mngsiteadmin.aspx

Manage Sites and Workspaces
url: /_layouts/mngsubwebs.aspx

Manage People
url: /_layouts/people.aspx

Manage User Permissions
url: /_layouts/user.aspx

Master Page Gallery
url: /_catalogs/masterpage
Also includes Page Layouts
Modify Navigation
/_layouts/AreaNavigationSettings.aspx

Recycle Bin
url: /_layouts/AdminRecycleBin.aspx

Site Column Gallery
url: /_layouts/mngfield.aspx

Site Content Types
url: /_layouts/mngctype.aspx

Site Content and Structure Manager
url: /_layouts/sitemanager.aspx

Site Settings
url: /_layouts/settings.aspx

Site Template Gallery
url: /_catalogs/wt

Site Usage Summary
url: url: /_layouts/SpUsageWeb.aspx

User Alerts
url: url: /_layouts/sitesubs.aspx

View All Site Content
url: /_layouts/viewlsts.aspx

Web Part Gallery
url: /_catalogs/wp

Web Part Page Maintenance
url: ?contents=1

Add to the end of the page URL
Workflows
url: /_layouts/wrkmng.aspx

Monday, October 13, 2008

Custom field type that can hold more than the 255

Many people ask me, they need to use field holds more than the 255 characters. They used MultiLine text. It worked fine with custom list but failed (generate error can't hold than 255 characters) with content type.
Many bloggers suggest to create custom field type, I tried this suggestion but gave me same result.
I found simplest solution Create Site Column of type MultiLine text, and set property UnlimitedLengthInDocumentLibrary to TRUE.
You can use tool Imtech Fields Explorer v1.5.0.0 to set this property.
download Imtech Fields Explorer v1.5.0.0

Friday, September 26, 2008

SharePoint 2007 Utilities

This is list of best tools to help you to administrate and support SharePoint 2007:

  1. SharePoint Manager 2007:
    The SharePoint Manager 2007 is a SharePoint object model explorer. It enables you to browse every site on the local farm and view every property. It also enables you to change the properties (at your own risk). This is a very powerfull tool for developers that like to know what the SharePoint holds of secrets.
  2. Download SharePoint Manager 2007

  3. Sharepoint Logging Spy
    Sharepoint Logging Spy is a real time diagnostic application for MOSS 2007 which allows a sharepoint administrator to view (and save to disk) the ULS Log & Event log entries from multiple machines in a sharepoint farm through a single console.

    Download Sharepoint Logging Spy
  4. SharePoint Content Deployment Wizard
    The SharePoint Content Deployment Wizard is a tool for SharePoint 2007 which provides the means to deploy the following content:
    - site collections
    - webs
    - lists
    - folders
    - list items (including files)

    Download SharePoint Content Deployment Wizard
  5. FaultyFeatureTool:
    The SharePoint FaultyFeatureTool is tool to discover any feature has a fault

    Download FaultyFeatureTool
  6. Imtech Fields Explorer v1.5.0.0
    Tool to simplify your work with Layouts, content types, sites columns
    for more information go to url

Download Fields Explorer

Unlimited length text field

SharePoint 2007 SPFieldMultiLineText is limited to 255 characters. How do we bypass this restriction?

We need to create a new field that inherits from SPFieldMultiLineText. and create your own FLDTYPES.XML file.

First We have to create custom field
public class CustomMultilineField : SPFieldMultiLineText
{
#region SPField Constructors
public CustomMultilineField(SPFieldCollection fields, string fieldName) : base(fields, fieldName)
{

}

public CustomMultilineField(SPFieldCollection fields, string typeName, string displayName) : base(fields, typeName, displayName)
{

}
#endregion

public new string GetFieldValueAsHtml(object value, SPListItem item)
{
string html = base.GetFieldValueAsHtml(value, item);
return html.Replace("CreateWebPage", "CreateCustomPage");
}

public override BaseFieldControl FieldRenderingControl
{
get
{
BaseFieldControl fieldControl = new CustomMultilineFieldField();
fieldControl.FieldName = InternalName;
return fieldControl;
}
}
}

Render a Control


public class CustomMultilineFieldField : NoteField
{
protected override void RenderFieldForDisplay(HtmlTextWriter output)
{
CustomMultilineField field = (CustomMultilineField) Field;
if (field != null)
{
if (field.CustomMultilineFieldLinking)
{
output.Write("<div class=\"ms-CustomMultilineFieldcontent\">");
output.Write(field.GetFieldValueAsHtml(ItemFieldValue, ListItem));
output.Write("<p></p></div>");
return;
}
}
else
{
return;
}
base.RenderFieldForDisplay(output);
}
}

Create a definition file

<FieldType>
<Field Name="TypeName">CustomMultilineField</Field>
<Field Name="ParentType">Note</Field>
<Field Name="TypeDisplayName">
CustomMultilineFieldField
</Field>
<Field Name="TypeShortDescription">
CustomMultilineFieldField supports custom page
</Field>
<Field Name="UserCreatable">FALSE</Field>
<Field Name="ShowInListCreate">FALSE</Field>
<Field Name="ShowInSurveyCreate">FALSE</Field>
<Field Name="ShowInDocumentLibraryCreate">FALSE</Field>
<Field Name="ShowInColumnTemplateCreate">FALSE</Field>
<Field Name="Sortable">FALSE</Field>
<Field Name="Filterable">FALSE</Field>
<Field Name="FieldTypeClass">IdeSeg.SharePoint.CustomMultilineFields.CustomMultilineField.CustomMultilineField,IdeSeg.SharePoint.CustomMultilineFields,Version=1.0.0.0, Culture=neutral, PublicKeyToken=...</Field>
</FieldType>

Tuesday, September 2, 2008

Programmatically Inherit Master Page and CSS in MOSS 2007

So recently I have been working on two small MOSS features:

  • Change the master page and stylesheet settings for a site
  • Staple the first feature to all site templates, so it is activated upon site creation

SharePoint Object Model:

  • SPSite is a Site Collection
  • SPWeb is a Site within a Site Collection

there are a couple of properties of the SPWeb object which we will be using:

  • [web_object].MasterUrl
  • [web_object].CustomMasterUrl
  • [web_object].AlternateCssUrl

These values are read/write, so you can set the values to your own strings and the values in the database will be changed accordingly.

Note: all of the following is done within the FeatureActivated function of a custom class inheriting from the SPFeatureReceiver class. Now let’s dive into some code (these are all different methods I tried to no avail)

Created some variables and hard coded the locations within the feature:

string MasterUrl = "/_layouts/custom.master";
string CustomMasterUrl = "/_layouts/custom.master";
string AlternateCssUrl = "/StyleLibrary/Custom/CSS/stylesheet.css";
SPWeb web = (SPWeb)properties.Feature.Parent;
try {
web.MasterUrl = MasterUrl;
web.CustomMasterUrl = CustomMasterUrl;
web.AlternateCssUrl = AlternateCssUrl;
web.Update();
}catch { }

Set the values of the current site to the values from the root site:

SPWeb web = (SPWeb)properties.Feature.Parent;
try {
web.MasterUrl = web.Site.RootWeb.MasterUrl;
web.CustomMasterUrl = web.Site.RootWeb.CustomMasterUrl;
web.AlternateCssUrl = web.Site.RootWeb.AlternateCssUrl;
web.Update();
}catch { }

Set the values of the current site to the values from it’s parent site:

SPWeb web = (SPWeb)properties.Feature.Parent;
try {
web.MasterUrl = web.ParentWeb.MasterUrl;
web.CustomMasterUrl = web.ParentWeb.CustomMasterUrl;
web.AlternateCssUrl = web.ParentWeb.AlternateCssUrl;
web.Update();
}catch { }

None of these methods, upon going to the “Site Master Page Settings” page within a browser, showed the little radio button next to “Inherit site master page from parent of this site” as being checked. They did correctly set the master page and stylesheet links, but if I went to a parent site and changed the master page, the master page did not get changed on the site *unless* the “inherit” radio button was selected.

I decided to take this to the Content Database for the portal in which I was working. Looking in the dbo.Webs table, I found that if the “Inherit” radio button is selected, there are still values in the DB for AlternateCssUrl, MasterUrl, and CustomMasterUrl. Running the above code, would put the same values in these fields, but the “Inherit” radio button would not be selected. I then performed the following steps:

  • Copy a row (one site) from the database to a text file
  • Change each of the 3 settings (Site Master, System Master, and Alternate CSS) from “Inherit” to “Specify a …”
  • Copy the same row from the database to the second row of the text file
  • Change each of the 3 settings back to “Inherit”
  • Copy the same row from the database to the third row of the text file
  • Change each of the 3 settings back to “Specify a …”
  • Copy the same row from the database to the fourth row of the text file

I then moved the side-scroll-bar all the way to the right (to confirm something in each lines was different) and they did not end at the same character, so I went to the beginning and compared vertically until I found different characters. There were a total of 3 instances of different characters (all 3 instances had the same characters) all within the same field, ‘MetaInfo’. These values were:

  • “Inherit”: 547275
  • “Specify a …”: 46616C73

Going back to the SharePoint Object Model, I discovered that there are two member properties to the SPWeb object which seem to correlate to site properties: Properties and AllProperties. I then tossed together a quick console app to output all Key/Value pairings for these two collections, and this is what came out:

  • SPWeb.Properties (C# type SPPropertyBag)
    • vti_extenderversion: 12.0.0.4518
    • vti_associatevisitorgroup: 4
    • vti_defaultlanguage: en-us
    • vti_associategroups: 5;4;3;6;7;8;9;10;11;14;15;17;18;28
    • vti_associateownergroup: 3
    • vti_associatemembergroup: 5
  • SPWeb.AllProperties (C# type Hashtable)
    • vti_extenderversion: 12.0.0.4518
    • __InheritsCustomMasterUrl: False
    • vti_associatevisitorgroup: 4
    • vti_categories: Business Competition Expense\ Report Goals/Objectives Ideas In\ Process
    • Miscellaneous Planning Schedule Travel VIP Waiting
    • vti_associatemembergroup: 5
    • vti_defaultlanguage: en-us
    • vti_associateownergroup: 3
    • vti_associategroups: 5;4;3;6;7;8;9;10;11;14;15;17;18;28
    • __InheritsAlternateCssUrl: False
    • vti_approvallevels: Approved Rejected Pending\ Review
    • __InheritsMasterUrl: False

Fancy that, there are three properties which interest me most at this point (indicated in red).
I simply set these values to “True” (note, that is a string of “True” and not a 1 or C# true)

However, it did not pull the correct values to begin with. Therefore, it would appear that SharePoint uses these settings for when the parent’s master pages/css are changed, and not relying on these settings for everytime the site is accessed.

All in all, here is the final code I came up with for my Feature (inside FeatureActivated function):

SPWeb web = (SPWeb)properties.Feature.Parent;
Hashtable hash = web.AllProperties;
try {
web.MasterUrl = web.ParentWeb.MasterUrl;
hash["__InheritsMasterUrl"] = “True”;
web.Update();
}catch { }
try {
web.CustomMasterUrl = web.ParentWeb.CustomMasterUrl;
hash["__InheritsCustomMasterUrl"] = “True”;
web.Update();}catch { }
try {
web.AlternateCssUrl = web.ParentWeb.AlternateCssUrl;
hash["__InheritsAlternateCssUrl"] = “True”;
web.Update();
}catch { }