Friday, May 29, 2009

The path specified cannot be used at this time. (Exception from HRESULT: 0x80070094)

I was receiving this exception every time when I tried to create a new web application (with a new application pool).

After receiving the message, I deleted the web application then I tried to open IIS to make sure the new application pool was also removed. IIS failed to open and I received the same message
"The path specified cannot be used at this time. (Exception from HRESULT: 0x80070094) "

To resolve this issue we need to follow the steps shown below:

1)IISREST.
2)Go to Services -->restart the "Windows SharePoint Services Timer".
3)if still fail ? restart windows server.

This is not a moss error but it is a windows 2003 error.

Friday, May 8, 2009

Sql function to Convert VARCHAR to INT

To Convert the value from varchar to int I created a small function as shown below:

Create Function [dbo].[CsvToInt] ( @Array varchar(1000)) returns @IntTable table (IntValue int)ASbegin
declare @separator char(1) set @separator = ','
declare @separator_position int declare @array_value varchar(1000) set @array = @array + ',' while patindex('%,%' , @array) <> 0 begin select @separator_position = patindex('%,%' , @array) select @array_value = left(@array, @separator_position - 1) Insert @IntTable Values (Cast(@array_value as int))
select @array = stuff(@array, 1, @separator_position, '') end
return end

Gradient Background using CSS without Images

1) The background-color is needed for Firefox as this seems to be unsupported in Firefox.
2) The rest of the code is self explanitory you have the start color and the finish color and the gradientType.
3) When the gradientType is set to 0, it is vertical from top to bottom.
4) When the gradientType is set to 1, it is horizontal from left to bottom.
5) If you are viewing this site within Internet Explorer or an IE based browser, the title bar has its
own gradient.
CSS:
body{background-color:#F8F8F8;filter: progid:DXImageTransform.Microsoft.Gradient(startColorStr='#FFCCFF' ,endColorStr='#8fffff' ,gradientType= '0' );width:400px;} body{background-color:#F8F8F8;filter: progid:DXImageTransform.Microsoft.Gradient(startColorStr='#FFCCFF' ,endColorStr='#8fffff' ,gradientType= '1' );width:400px;}
HTML:
<div>
This is the test message to understand how to get Gradient BackGround in IE using CSS without any need of Images.
</div>


Scroll bar for Repeater Control

Specify a height for Repeater Control by placing it in Panel or in div.If the records exceed the given height then Scroll bar should appear .We can achieve by using CSS given below.

Example:


.Panel
{
Height:200px;
width:100%;
overflow-y:scroll;
}

Query to Retrieve all the Tables,Views,Stored Procedure and Functions from Sql Server

Select * from sys.all_objects
Select * from information_schema.columns
Select * from information_schema.tables

Rounded Corners Using CSS and without Images

We can easily create Rounded Corners in the html Page with CSS, there is no need of images.
Just Copy and Paste the below CSS (Cascade Style Sheet) and Html in Page.




CSS:

.b1f, .b2f, .b3f, .b4f{font-size:1px; overflow:hidden; display:block;}
.b1f {height:1px; background:#0384ab; margin:0 5px;}
.b2f {height:1px; background:#0384ab; margin:0 3px;}
.b3f {height:1px; background:#0384ab; margin:0 2px;}
.b4f {height:2px; background:#0384ab; margin:0 1px;}
.contentf {background: #0384ab;width:100%}
.contentf div{margin-left: 5px;}
.itemCss{float:left;width:400px;padding:5px;color:#ffffff}

HTML:

<div style="width:400px;">
<b class="b1f"></b><b class="b2f"></b><b class="b3f"></b><b class="b4f"></b>
<div class="contentf">
<div class="itemCss">
This is the test message to understand how Rounded Corners obtained only with CSS.
There is no need of images to get Rounded Corners.
</div>
</div>
<b class="b4f"></b><b class="b3f"></b><b class="b2f"></b><b class="b1f"></b>
</div>

Thursday, May 7, 2009

Increase the Site Template and List Template Size

1) Generally to Create the Site Template for the Site ,the site shouldnot exceed more than 10MB.

2) If the Site exceeds it will prompt error message as shown below.

3) To resolve this problem we need to increase the Size of the Site Template by running this command shown below.

Command:

Site Template:
Default size = 10MB
stsadm -o setproperty -pn max-template-document-size -pv 20000000
(Where max-template-document-size is in Bytes)
Upper limit(Cap) = 500MB.


ListTemplate:
Default size = 10MB
stsadm -o setproperty -propertyname max-template-document-size -propertyvalue 50000000
(Where max-template-document-size is in Bytes)
Upper limit(Cap) = 500MB.







Steps to Change the DocIcons in SharePoint Sites

1)Download your Required DocIcon Image(DocIconName.gif) and save it in ("c:\Program Files\Common Files\Microsoft Shared\web server extensions\12\Template\Images") your mages folder.
2)Now Open the DOCICON.xml file located at "C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\XML".
3)Add this "<Mapping Key="pdf" Value="pdf.gif"/>" ,this is the location where all the DocIcons are register.

Add Upload Attachement functionality for Comment List in SharePoint Blog Site

1) We have the option to add the Comment for the Post in the SharePoint Blog Site, but we dont have the option to Upload the Attachment for the Comment to the particular Post as shown below


2) If we want to add that Upload Attachment for the Comment, we need to edit the page http://SiteUrl/Lists/Posts/Post.aspx in the browser.

3) Then add the Content Editor WebPart below the Comments WebPart as shown below.


4) Now add the "table" tag as given below.


<table class="ms-toolbar" cellpadding="2" cellspacing="0" border="0" id="ctl00_m_g_4e9517cc_cbfa_4ac0_b45a_4f1f64696c60_ctl00_ctl01_ctl00_toolBarTbl" width="100%" >
<tr>
<td class="ms-toolbar" nowrap="true">
<table cellpadding='1' cellspacing='0'>
<tr>
<td class='ms-toolbar' nowrap>
<a href="javascript:UploadAttachment()" onclick="javascript:UploadAttachment();" accesskey="I" title="Add a Attachment" class='ms-toolbar'>
<img align='absmiddle' alt="Add a Attachment" src="/_layouts/images/attachtb.gif" style='border-width:0px;' width='16' height='16'>
</a>
</td>
<td class='ms-toolbar' nowrap>
<a id="ctl00_m_g_4e9517cc_cbfa_4ac0_b45a_4f1f64696c60_ctl00_ctl01_ctl00_toolBarTbl_RptControls_diidIOAttach" style="visibility:hidden;" href="javascript:UploadAttachment()">
</a>
<a href="javascript:UploadAttachment()" onclick="javascript:UploadAttachment();" accesskey="I" id="ctl00_m_g_4e9517cc_cbfa_4ac0_b45a_4f1f64696c60_ctl00_ctl01_ctl00_toolBarTbl_RptControls_diidIOAttach_LinkText" class='ms-toolbar'>Add a Attachment</a>
</td>
</tr>
</table>
</td>
<td width="99%" class="ms-toolbar" nowrap><IMG SRC="/_layouts/images/blank.gif" width=1 height=18 alt="">
</td>
</tr>
</table>

5) Finally, you added the Attachement for the Comments.



6) Looks Cool right :-)?

Integrate Silverlight in SharePoint

1) Initially we require html Page,Images and .XAP file of the Silverlight Application.

2) Upload the .xap file and Images Required into the SharePoint document library.

3) Add the Content Editor WebPart in the Page .

4) Copy the Script tag consists of javascript and html tags present in the body tag from the html page and Paste it in the Source Editor of the Content Editor WebPart, looks like as shown below

<script type="text/javascript">
function onSilverlightError(sender, args) {

var appSource = "";
if (sender != null && sender != 0) {
appSource = sender.getHost().Source;
}
var errorType = args.ErrorType;
var iErrorCode = args.ErrorCode;

var errMsg = "Unhandled Error in Silverlight 2 Application " + appSource + "\n" ;
errMsg += "Code: "+ iErrorCode + " \n";
errMsg += "Category: " + errorType + " \n";
errMsg += "Message: " + args.ErrorMessage + " \n";
if (errorType == "ParserError")
{
errMsg += "File: " + args.xamlFile + " \n";
errMsg += "Line: " + args.lineNumber + " \n";
errMsg += "Position: " + args.charPosition + " \n";
}
else if (errorType == "RuntimeError")
{
if (args.lineNumber != 0)
{
errMsg += "Line: " + args.lineNumber + " \n";
errMsg += "Position: " + args.charPosition + " \n";
}
errMsg += "MethodName: " + args.methodName + " \n";
}
throw new Error(errMsg);
}
</script>
<!-- Runtime errors from Silverlight will be displayed here.
This will contain debugging information and should be removed or hidden when debugging is completed -->
<div id='errorLocation' style="font-size: small;color: Gray;"></div>
<div id="silverlightControlHost">
<object data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="810px" height="550px">
<param name="source" value="/Shared Documents/Trial.xap"/>
<param name="onerror" value="onSilverlightError" />
<param name="background" value="white" />
<param name="minRuntimeVersion" value="2.0.31005.0" />
<param name="initParams" value="ServiceUrl=http://ws27/Trial.Service/Service1.svc/" />
<param name="autoUpgrade" value="true" />
<a href="
http://go.microsoft.com/fwlink/?LinkID=124807" style="text-decoration: none;">
<img src="
http://go.microsoft.com/fwlink/?LinkId=108181" alt="Get Microsoft Silverlight" style="border-style: none"/>
</a>
</object> </div>

5) Provide the actual Path of the xap file in param tag shown above.

Create Custom Styles for the RichTextEditor in SharePoint

If we want to add the custom styles to Rich Text Editor present in (Content Editor web part) we need to follow the below steps:
  • Open the Custom Style Sheet which you are Created for the Site(by default core.css will apply for SharePoint Sites).
  • Add the Custom Style which Starts with ".ms-rteCustom-"
    For e.g: .ms-rteCustom-SquareBulletList{Font-family: arial; Line-style-type: square}.
    Now the above custom style will appear on Styles tab located in the Rich Text Editor toolbar as name “SquareBulletList” as shown below.

Note:The Custom Styles which we created will appear only when the text is selected in Rich Text Editor as shown above.
Images: "IMG.ms-rteCustom-yourstylename"
Links: "A:link.ms-rteCustom-yourstylename"
Numbered Lists: "OL.ms-rteCustom-yourstylename"
Un-Numbered Lists: "UL.ms-rteCustom-yourstylename"
Basic text: ".ms-rteCustom-yourstylename"
These are some of the Cusotm Style formats for RichTextEditor used in the Content Editor WebPart.