Archive

Archive for May, 2011

Download the Sharepoint List Attachment

May 28, 2011 Leave a comment

You can download the attachment from the any SharePoint List to your local drive in your Server using the following code. Based on the article from Microsoft “How to Pro grammatically Download attachment from list items in WSS” i iterate the list item and also i checked for Exist of attachment for each list item.

Inherited Web-part Class and create the button control and attach the click event, in the “CreateChildControls” method as below code

(Click on above image to Enlarge the Image)

Now write the code to download the attachment from the List as below in the Button Click event Method

(Click on above image to Enlarge the Image)
Now you create a custom web-part for download the attachment of the list. Create Strong key and build the class deploy it in your Server and update the Web.Config. Add it in web-part gallery and edit the page select the web-part to download attachment. that it. When you click on the web-part, it will automatically download all attachment to the specified path.

Advertisements
Categories: Sharepoint

Programatically copy document from list to library

May 28, 2011 Leave a comment

Using this below code you can copy the document from list to library, with in the same web application. The logic is as below

Categories: Sharepoint

check the same child window form is already opened

May 27, 2011 Leave a comment

int FlagMultiple=0;
                foreach (Form Objform in Application.OpenForms)
                {
                    if (Objform.Text == "FormText")
                    {
                        Objform.BringToFront();
                        FlagMultiple=1;
                    }
                }
                if (FlagMultiple!=1)
                {
                    Form1 objForm = new Form1();
                    objForm.MdiParent = this;
                    objForm.StartPosition = FormStartPosition.CenterScreen;
                    objForm.Show();
                }
Categories: Win App

Stsadm operations

May 16, 2011 Leave a comment

· Activatefeature
Activates a feature in the feature collection.
· Addalternatedomain
Adds an internal URL and maps it to one of the five URL zones of a Web application or external resource.
· Addcontentdb
Creates a new content database or adds a database that needs to be upgraded when the url and databasename parameters are specified.
· Adddataconnectionfile
Adds a new DataConnectionFile to the DataConnectionFiles collection for InfoPath Forms Services.
· Add-ecsfiletrustedlocation
Lets an administrator add a file to the trusted location list.
· Add-ecssafedataprovider
Lets an administrator add a supported provider type to the safe provider list.
· Add-ecstrusteddataconnectionlibrary
Adds a trusted data connection to a library.
· Add-ecsuserdefinedfunction
Adds a user defined function.
· Addexemptuseragent
Adds a user agent, which is typically in the form of a search bot, to receive the XML file that contains the data of the form for indexing instead of the HTML rendering of the form.
· Addpath
Adds a managed path inclusion to a Web application.
· Addpermissionpolicy
Adds a user to a policy role for the Web application based on the specified permission level name and corresponding zone.
· Addsolution
Adds a solution file to the solution store.
· Addtemplate
Adds a site template to the template gallery.
· Adduser
Adds a user account to the specified site collection and assigns it to the specified site group.
· Authentication
Authentication provides the user identity input to the authorization process which determines what actions the current user is allowed to perform on a given object.
· Backup
Describes how to back up a site collection, an individual database, a Web application, or an entire farm.
· Backuphistory
Displays a history of backup and restore operations that have been run.
· Creategroup
Lets site collection administrators create new groups from any site collection.
· Createsite
Creates a site collection at the specified Uniform Resource Locator (URL) with the specified user as site collection owner and site collection administrator.
· Deletecontentdb
Detaches a content database when the Web application, database name, and database server are specified.
· Deleteconfigdb
Unprovisions the local machine from the farm and deletes the configuration database (but does not drop the configuration database).
· Deletegroup
Deletes a group created in Microsoft Office SharePoint Server 2007.
· Deletesite
Deletes the site collection with the specified URL from the Web application.
· Deletesolution
Removes a Windows SharePoint Services Solution Package (*.wsp) from the solution store.
· Deletessp
Deletes a Shared Services Provider (SSP) in a Web application when the title parameter is specified.
· Deletessptimerjob
Deletes all of the timer jobs in the Shared Services Provider (SSP).
· Deletetemplate
Deletes a specified site template from the site template gallery.
· Deleteuser
Deletes a user account from the specified site collection and specified site.
· Deleteweb
Deletes a subsite using the specified Uniform Resource Locator (URL).
· Deploysolution
Deploys files related to a solution from the configuration database to individual front-end Web servers in the farm.
· Displaysolution
Displays specific solution or Web Part information in a solution store.
· Editssp
Allows the site collection administrator for the Shared Services Administration site to perform the following functions:
· Change the databases that a Shared Services Provider (SSP) uses.
· Change the SQL credentials associated with the SSP databases.
· Modify the service account credentials.
· Rename an SSP
· Email
Sets the e-mail configuration settings for your server.
· Export
Exports site and subsite data from your Microsoft Office SharePoint Server 2007 installation.
· Import
Imports site and subsite data from your Microsoft Office SharePoint Server 2007 installation.
· Installfeature
Installs a feature.
· Renameserver
Changes the name of the specified server in the configuration database.
· Renamesite
Changes a URL of a host-named site collection to a new URL.
· Renameweb
Changes the URL of a subsite.
· Restore
Explains how a restoration of a site collection, an individual database, a Web application, or an entire farm is performed.
· Restoressp
Creates a Shared Service Provider using a restored database.
· Retractsolution
Retracts the specified solution’s deployment, and removes files from the front-end Web server.
· Scanforfeatures
Scans for new features in the file system, and if new features are present, installs them.
· Setconfigdb
Creates a new configuration database in a farm or joins the local computer to an existing farm’s configuration database.
· Setdefaultssp
Sets a Shared Services Provider (SSP) as the default SSP in a farm.
· Setlogginglevel
Sets the Windows event log and trace log logging level for one or more diagnostic logging categories registered in the farm.
· Setsitelock
Sets a value that specifies whether the site collection is locked and unavailable for read or write access.
· Siteowner
Sets the primary or secondary administrator of a site collection.
· Setworkflowconfig
Enables or disables the workflow settings
· Upgradesolution
Upgrades an existing solution. The solution to be upgraded could be either deployed or not deployed; however, the immediate or time parameters apply only if the solution has been deployed.
· Userrole
Adds or deletes permission levels to site groups.

Categories: Sharepoint

22 Ways to Become Spectacularly Inspirational

May 16, 2011 Leave a comment

1. Do important work vs. merely offering opinions.
2. Lift people up vs. tear others down.

3. Use the words of leadership vs. the language of victimhood.

4. Don’t worry about getting the credit for getting things done.

5. Become part of the solution rather than part of the problem.

6. Take your health to a level called superfit.

7. Commit to mastery of your craft instead of accepting mediocrity in your work.

8. Associate with people whose lives you want to be living.

9. Study for an hour a day. Double your learning and you’ll triple your success.

10. Run your own race. “No one can possibly achieve real and lasting success by being a conformist,” wrote billionaire J. Paul Getty

11. Do something small yet scary every single day.

12. Lead Without a Title.

13. Focus on people’s strengths vs. obsessing around their weaknesses.

14. Remember that potential unused turns into pain. So dedicate yourself to expressing your best.

15. Smile more.

16. Listen more.

17. Read the autobiography of Nelson Mandela.

18. Reflect on the words of Eleanor Roosevelt who said: “Great minds discuss ideas; Average minds discuss events; Small minds discuss people.”

19. Persist longer than the critics suggest you should.

20. Say “please” and “thank you”.

21. Love your loved ones.

22. Do work that matters.

Resource : RobinSharma

Categories: Inspirational

Custom Paging API

May 16, 2011 Leave a comment

Normally in Win Application you have Paging option is available only for moving to Next or Previous record, and move to First or Last Record. Suppose if you want to set page wise navigation then you have to go for custom paging.

In codeplex you can find CustomPaging API this is an alpha release, they provide an set of inbuild methods for Record Navigation, and page navigation. You can make use this CustomPaging API to any Application both Windows or Web Application. You can download this CustomPaging API form here [Click Here To Download]

Class Description

Available Function in dsPaging

Properties

1) NumberOfRecordPerPage

Note:- This NumberOfRecordPerPage must be specify before you call any static method from below for paging at first time. This property hold how many number of records can disply per page.

Static Methods

1) List nextRow(int curentgridindex, int currentpage, int totalrowcount)

2) List previuosRow(int curentgridindex, int currentpage, int totalrowcount)

3) List nextPage(int curentgridindex, int currentpage, int totalrowcount)

4) List previousPage(int currentpage, int totalrowcount)

5) List LastRecord(int totalrowcount)

6) List FirstRecord()

7 ) List RefreshRow(int curentgridindex, int currentpage, int totalrowcount)

8 ) List GetPagePosition(int rowindex, int totalNumberofRow)

Note:-

Here curentgridindex:- Refer Current Select index of the grid

currentpage:- Current Page that is displayed on the grid

totalrowcount:- Total number of record that holds (Full row count and not per page row count)

rowindex:- Same as Currentgridindex.

Sample Code:

//Move to Next Row
private void NextRow_Click(object sender, EventArgs e)
{
int totalrowcount = ds.Tables[0].Rows.Count;
dsPaging.NumberOfRecordPerPage = Convert.ToInt32(textBox1.Text);
List poition = dsPaging.nextRow(currentindex, currentpage, totalrowcount);
currentindex = poition[0];
currentpage = poition[1];
Noofrow = poition[2];
ReFillGrid();
}
Any bug or Paging API question are always welcome.

Categories: dh

Create identity to create table with data

May 16, 2011 Leave a comment

Normally we can’t create the identity in the existing column, it must be created while creating the table. Suppose if you have a data in the table you want to add the identity in the table, we can do it in indirect way as below.

Consider the table as table1 and it contain a column as column1

Now am rename the table1 as table1_new as below

sp_rename ‘table1′,’table1_new’

Now create a new table as table1

create table table1(column1 int primary key identity(1,1))

then turn off identity

set identity_insert table1 on

Now copy all data from old table to new table as below

insert into table1(column1 )
select column1 from table1


Now turnon the identity

set identity_insert table1 off

Find the max value of column

select MAX(column1) from table1

Reseed the identity as below

DBCC CHECKIDENT (table1, RESEED, 220);

Now you can make use of the table along with identity as before

Categories: SQL
%d bloggers like this: