Showing posts with label MOSS 2007. Show all posts
Showing posts with label MOSS 2007. Show all posts

Thursday, March 25, 2010

MOSS: Where to place generic Javascript in MOSS Server

Hey Reader!

(writing on demand from Mr.Murthu Buddy :))

When you need to use a javascipt in your html page in MOSS Sharepoint.

you can place the Javascript file in the following location:

C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\LAYOUTS\js\mootools-1.2-core.js

and in your HTML file, you can refer it like:

<script type="text/javascript" src="http://portal/_layouts/js/mootools-1.2-core.js">
script>


Hope it Helpz


Sunday, December 6, 2009

How to read & write value from Infopath Datasource throught C#

Hi,

In a requirement, we need to display views based on the current user who updates the infopath form. So I thought let me write the logic to read and store values in Info path Data source from code behind. Following Code useful.

Read:
XPathNavigator nav = MainDataSource.CreateNavigator();
string fieldValue = nav.SelectSingleNode("//my:Myfield1", NamespaceManager).Value;

Write:
XPathNavigator nav = MainDataSource.CreateNavigator();
nav.SelectSingleNode("//my:Myfield1", NamespaceManager).SetValue("NewValue");

essential Namespace is Microsoft.Office.InfoPath;

Hope it helps...

Best Regards
Fauzi ~4Z

Monday, November 30, 2009

Publish Infopath form with CodeBehind

Hey,

When I publish a normal infopath form without code behind, I was able to publish them from Info path editor it self and on click of 'New' in forms library, i was able to view the form in the Browser. But when i tried to publish with Codebehind and Click 'New' the form only opened in a New editor!

When i googled for the same, came to know that when we add code behind logic (say with C#) first we need to publish and later we need to approve the info path form through Sharepoint Administration.

There are four steps to be implemented:

  • Publish the Template to the File System
  • Upload the Template to Central Administration Form Templates Library
  • Activate the Form Template in your Site Collection
  • Associate the Form Template with the Form Library
It is clearly given in the following Link: Click
Its very helpful...


Thanks
Fauzi

Sunday, November 8, 2009

MOSS: document-library file upload limitation

Hi,

When we created shared folder for our business users, I had a doubt about the file upload limitations which might occur when our users upload files. When i googled for the same found that the default size is set to be 50MB (maxRequestLength="51200"). and to increase the limit we just need to configure the xml file in the following location

Solution:
C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\LAYOUTS\web.config

Config file:
<location path="upload.aspx">
<system.web>
<httpRuntime maxRequestLength="2097151" />
</system.web>
</location>

Resource: http://www.synergyonline.com/blog/blog-moss/Lists/Posts/Post.aspx?ID=8

Hope it helps

Regards
Fauzi ~4Z

Wednesday, October 14, 2009

MOSS: How to disable checkin option in document Library

Hey...

We had a requirement to disable checkin functionality in document library. The Idea was to reduce the steps to be done by the end user to upload documents easily. The bottom line was to make it simple for easy accessibility. Following are the steps to be done.

To enable/disable check-in and check-out on a SharePoint document library:

  1. Navigate to the SharePoint document library on which you want to enable check-in and check-out.
  2. On the Settings menu, click Document Library Settings .
  3. On the Customize page under General Settings , click Versioning settings .
  4. On the Document Library Versioning Settings page, select Yes /No for Require documents to be checked out before they can be edited? , and click OK .

To enable version control on a SharePoint document library:

  1. Navigate to the SharePoint document library on which you want to enable version control.
  2. On the Settings menu, click Document Library Settings .
  3. On the Customize page under General Settings , click Versioning settings .
  4. On the Document Library Versioning Settings page, select Create major versions if you only want to enable major versions on documents or select Create major and minor (draft) versions if you want both major and minor versions on documents, and click OK .

Reference

Hope It helps...

Fauzi 4z

Tuesday, July 7, 2009

MOSS: SharePoint_Config LDF file grows drastically

Hey Folks...

In our MOSS server database, the SharePoint_Config_log.LDF file of database SharePoint_Config grows drastically. surprisingly it reaches more than 100 GB in months time... due to this there occurs lack of disk space. Currently I have scheduled to run a SQL query given by my friend to shrink the LDF file.

SQL Query:

BACKUP LOG SharePoint_Config WITH TRUNCATE_ONLY
USE SharePoint_Config

GO
DBCC SHRINKFILE (SharePoint_Config_Log, EMPTYFILE)
GO

For time being this is the solution, If you are aware of any other permenant solution, please do let us know :)

Regards
Fauzi

Monday, July 6, 2009

MOSS: Install IT helpdesk Template

Hey,

Following are commands to be executed to install a template in MOSS Server. I have installed a site template for IT help desk with the following command. There are two steps to be basically.

1. Add solution:
Command:
C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN>stsadm -o addsolution -filename HelpDesk.wsp

Message shown execution is "Operation completed successfully."

2. Deploy solution:
While deploying we need to specify either the deployment is '-immediate' or '-local' or '-time' as parameter .
Command:
C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN>stsadm -o deploysolution -name HelpDesk.wsp -immediate -allowgacdeployment

Message shown execution is "Timer job successfully created."

Thats it :)

Regards
Fauzi

Thursday, June 25, 2009

Example for Internet facing MOSS site

Hi folks,
Here is a best example for internet facing MOSS site.
Its http://Sharepoint.Microsoft.com :)
Yup It has been recently developed with MOSS technologies by a consulting company Advaiya.
Envy those people who got the chance to work for the official site of Sharepoint ;) Lucky you...!

Resource : Nice article, it explains implementation of new features. Really inspiring.... Great job.

Regards
Fauzi

Sunday, June 14, 2009

MOSS: Free Master pages templates for SharePoint

Hi

You can download free Master page samples for SharePoint from Microsoft website.

Click to view the download page

The Link also has the instructions to setup.

Regards
Fauzi

Monday, June 8, 2009

MOSS: Code blocks are not allowed in this file

Hey...

When you try to add a server side code for an aspx page in your document library with the help of share point designer. you might get the following error when you try to view the page.

An error occurred during the processing of /Pages/Yourfile.aspx. Code blocks are not allowed in this file.

The reason is that Sharepoint by default disables server side code (code behind) for an aspx page. The Solution is we need to add the path of the page as exception in web.config.

Solution:

<PageParserPaths>

<PageParserPath VirtualPath="/pages/YourFile.aspx" CompilationMode="Always" AllowServerSideScript="true" />

</PageParserPaths>


Regards
Fauzi

Wednesday, June 3, 2009

Sample MOSS webpart & deployment

Hi Folks...

Seems people search for Sample MOSS webpart and land into my previous blog where i have written how to develop a webpart from your XP machine. So let us provide what people came looking for....

Following is a sample web part i created some time back which fetches data from database and displays in a table. The web part class should always inherit Webpart(System.Web.UI.WebControls.WebParts) as base class. For webparts we usually write the code to override any events like Render, RenderWebPart or RenderContent.
In the sample code i have overrided Render event which takes the parameter System.Web.UI.HtmlTextWriter object.

The Database operations i have used Application blocks from Enterprise Library

Namespace:

System.Web.UI.WebControls
;
System.Web.UI.WebControls.WebParts;

Code: There are appropriate comments give to explain its operation

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using System.Web;

using System.Data;

using System.Data.Sql;

using System.Data.SqlClient;

using System.Web.UI.WebControls;

using System.Web.UI.WebControls.WebParts;

using Microsoft.ApplicationBlocks.Data;

namespace Newwebpart1

{

public class Newwebpart1 : WebPart

{

protected override void CreateChildControls()

{

base.CreateChildControls();

//Control can be created here...

}

protected override void Render(System.Web.UI.HtmlTextWriter writer)

{

//We Create a SQL connection

SqlConnection objSqlConnection = new SqlConnection("Data Source=44.44.44.44;Initial Catalog=<YOUDB>;Persist Security Info=True;User ID=<USERNAME>;Password=<PASSWORD>");

//We execute a SQL Query & get a Dataset in return

DataSet objDataSet = SqlHelper.ExecuteDataset(objSqlConnection, System.Data.CommandType.Text, "SELECT [COL1],[COL2] FROM [DB].[dbo].[TABLENAME]");

//We are creating a Table in runtime

Table objTable = new Table();

objTable.BorderStyle = BorderStyle.Solid;

objTable.BorderWidth = 1;

objTable.GridLines = GridLines.Both;

objTable.CellPadding = 1;

objTable.CellSpacing = 1;

objTable.BorderColor = System.Drawing.Color.Blue;

//Creating Header here:

TableRow objTableRow_Header = new TableRow();

TableCell objTableCell_Title1 = new TableCell();

objTableCell_Title1.Text = objDataSet.Tables[0].Columns[0].Caption;

TableCell objTableCell_Title2 = new TableCell();

objTableCell_Title2.Text = objDataSet.Tables[0].Columns[1].Caption;

objTableRow_Header.Cells.Add(objTableCell_Title1);

objTableRow_Header.Cells.Add(objTableCell_Title2);

objTable.Rows.Add(objTableRow_Header);

//Rows are added based on the number of records

for (int i = 0; i < objDataSet.Tables[0].Rows.Count; i++)

{

TableRow objTableRow_Content = new TableRow();

TableCell objTableCell_Column1 = new TableCell();

objTableCell_Column1.Text = objDataSet.Tables[0].Rows[i][0].ToString();

TableCell objTableCell_Column2 = new TableCell();

objTableCell_Column2.Text = objDataSet.Tables[0].Rows[i][1].ToString();

objTableRow_Content.Cells.Add(objTableCell_Column1);

objTableRow_Content.Cells.Add(objTableCell_Column2);

objTable.Rows.Add(objTableRow_Content);

}

//Writing content inside webpart with the help of object created for

//HtmlTextWriter

writer.Write("<div style='overflow:auto'>");

//Add the table which was created in runtime from the above code.

objTable.RenderControl(writer);

writer.Write("</div>");

}

}

}


Reference

Download Project: http://www.checkthiz.com/publicfiles/Download webpart.zip

Steps to deploy a webpart:

1. Right click on project file and select properties and strong name key for the Project.


2. Build the solution (Ctrl+ Shit +B)

3. The Assembly (dll) will be created in the bin folder.

4. Move the assembly to the GAC ( just drag & drop in C:\WINDOWS\assembly)

5. In the web.config of the Web application (Sharepoint Website) place the code in SafeControls tag with the PublicKeyToken found in the Assembly.

Sample:
SafeControl Assembly=", Version=1.0.0.0, Culture=neutral, PublicKeyToken=ASDFASDRTERFSDF" Namespace="" TypeName="*" Safe="True"

6. Reset IIS

7. Go to Site Action -> Settings -> Webparts -> New

8. You will find your webpart in the URL: http://YOURMOSSSERVER/_layouts/NewDwp.aspx .Select the checkbox for the respective webpart & click Populate Gallery Button.

9. Now go to any page in the site and in Edit mode you will be able to find the webpart to add it in your page.... Thats it...

Note: With the help of Web Part templates in visual studio the above steps are made much more easier! you can just click on RUN button. The studio it-self will deploy & reset the IIS, you can directly go to the page and add the Web part! Love you Templates :)

Hope it helps... try and have fun :)

Regards
Fauzi ~4Z