Pages

Thursday, September 17, 2009

Exciting Tool - stsadm

Hello All,

We all know that sharepoint central administration is the great UI which allows us to to all administration operation for the sharepoint.

but there is something more powerful command line tool in sharepoint known as STSADM.

location:- 12\BIN\STSADM.EXE

here is the link to all stsadm commands : all stsadm commands

there is some thing called customizationof these commands.

gl-tool is the great tool which is customized stsadm commands and allows you more power.
visit this link to know more

Playing Flash (.swf) Files in the SharePoint

Hello All,

actually I was trying my hands on the playing the animated images on the sharepoint web pages and was successful to show animated .gif files on web page.

so , I was thinking to play some more animations on the sharepoint site without use of any other custom web part.
what all I wanted was to play the flash file on sharepoint site without using video and other webparts.

so we can do this by using very useful webpart in sharepoint that is Content Editor Webpart.

what all you need to do is:


Upload the flash video file to the any document Library of the website open video file from document library and copy url.


1. open your page in the edit mode
2. add the content editor webpart on page

3. click on modify shared properties of the content editor webpart

4. open the tool pane and open source editor

5. write this code inside the source editor and you are done!!



<object width="1000" height="100">
<embed src="url to .swf file="1000" height="100"></embed>
</object>


(you can adjust height and width of the flash accordingly)

Thursday, September 10, 2009

Working with SharePoint Item Events

Hello All,

before some days I was working with the SharePoint list items and their events.

I just wanted to add small suggestion here that while working with the SPItemEventReceiver class or with the class that inherits from SPItemEventReceiver, we oftenly override the methods like

ItemAdding , ItemAdded, ItemUpdating, ItemUpdated.....etc

so many times scenario comes that we need to update something in the list and on some event but other events are stopping that
so to avoid this error

use

this.DisableEventFiring();
//update list or any listitem here
this.EnableEventFiring();

this works fine and avoids error.

please let me know If you find any improvement to be done in this.

Get HTML of .aspx page

Hello All,

before some days I was working with the .aspx pages and got in the situation that I needed the source of the page from code.

I am posting this small code snippet might be useful for others also

(Note:- There might be some issue while getting html source from the web page due to some network settings like proxies and secure sockets.)

//this creates a request to a web page.

HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create("url of webpage");

//use this for obtaining settings of network

request.AuthenticationLevel = System.Net.Security.AuthenticationLevel.None;

request.Credentials = System.Net.CredentialCache.DefaultCredentials;

HttpWebResponse responce = (HttpWebResponse)request.GetResponse();
Encoding encoding = Encoding.GetEncoding(responce.CharacterSet);

//gets responce in the format of stream

Stream stream = responce.GetResponseStream();

//use StreamReader to read the stream contents


StreamReader reader = new StreamReader(stream, encoding);

string content = reader.ReadToEnd();

then you can use this obtained string content for any purpose like writing to a file.

Please suggest me If you find some improvements to be done in this.