Not Defteri

Akılda duracagına burda dursun

SharePoint Management Studio - Solution Deployer

SharePoint Management Studio is a Open Source SharePoint Administration Tools that helps you manage your sharepoint enviroment simple and easy. SharePoint Management Studio (SPMS) has a module named Solution Deployer. Solution deployer is a powerfull application to deploy your solutions easy. Solution Deployer can deploy multible solution file to multible web applications. For example you need to new Sharepoint farm as a preprotuction and you want to same configration to production to preprotuction. Notice that you install new farm and create all webapplication now you can add solution new farm and deply it global or web applications. if you has 10 solution files and 5 web application you can perform 100 jobs to do this. Because you must run 10 addsolution command and 10 solutin X 5web applications deploy.  Solution Deployer do all of them for you. (http://spms.codeplex.com/)

The other properties is Solution deployer understand solution file type authomaticly. GLOBAL deployet or web application deployment.

Posted: Jun 13 2010, 22:26 by kkaradag | Comments (0) RSS comment feed |
  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Filed under: SharePoint 2007 | Tools

SharePoint Management Studio - Download installed Solutions

SharePoint Management Studio is a Open Source SharePoint Administration Tools that helps you manage your sharepoint enviroment simple and easy. SharePoint Management Studio (SPMS) has a module named Download installed Solutions to export Solution Files from Solution Store.By default Sharepoint don't allow download your solutions on central admin. (http://spms.codeplex.com/)

This section has only two options one of them Deploy Solution and the other one is Romove Solution. One day I lost my solution instalation setup and wsp file and I need to deploy same solution the other farm. This tool was very usefull for me. Download this application source code codeplex or my site and run application your Sharepoint enviroment.   Application load your web application list and wait your selection wich application solution(s) you want to download or global deployed applications.

Click wich solution you want download and click Save as button. Application ask you a destination directory. Select ona and click okey.  Finaly application save your solution which you lost setup or wsp, download your destination directory.

 

Posted: Jun 13 2010, 22:18 by kkaradag | Comments (0) RSS comment feed |
  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Filed under: SharePoint 2007 | Tools

SharePoint Management Studio - Restore Backup

SharePoint Management Studio is a Open Source SharePoint Administration Tools that helps you manage your sharepoint enviroment simple and easy. SharePoint Management Studio (SPMS) has a module to Restore *.bck backup files to your sitecollections by a GUI. Normaly you can rESTORE site collection backup by stsadm.exe like stsadm.exe -o restore -url http://testsite -filename testsite.bck -overwrite but this module helps you restore your backups and protect you write too much command. (http://spms.codeplex.com/)

How is Works ? 

To run Perform a Backup fallow ;

- click Backup and Restore --> Site Operation --> Restore Backup  OR

-Click Ctrl + Shift + R key combinations.

Click Select Backup File button on Tool bar and select your .bck file that you want to restore. And select web Application from Web Application List and click Restore Selected file to Selected  Web App button.

After complate your restore SPMS write Restore was complate message.

Posted: Jun 13 2010, 21:55 by kkaradag | Comments (0) RSS comment feed |
  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Filed under:

SharePoint Management Studio - Perform Backup

SharePoint Management Studio is a Open Source SharePoint Administration Tools that helps you manage your sharepoint enviroment simple and easy. SharePoint Management Studio (SPMS) has new module to take your sitecollection backup by a GUI. Normaly you can site collection backup by stsadm.exe like stsadm.exe -o backup -url http://testsite -filename testsite.bck but this module helps you take multible backup one time and protect you write too much command. (http://spms.codeplex.com/)

How is Works ? 

To run Perform a Backup fallow ;

- click Backup and Restore --> Site Operation --> Perform a Backup  OR

-Click Ctrl + Shift + B key combinations.

Click to Connect To Farm Button on Tool Box. Notice that Application get avalible Web Applications that you can take a backup.

Select one or more web applications that you want to take backup. 

Click Start Backup Button. Notice that Application is runging and take a site backup which you has just selected.

After complate backup operation your .bck files will ready as SiteName + Date .bck format.

Posted: Jun 13 2010, 21:28 by kkaradag | Comments (0) RSS comment feed |
  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Filed under:

Add a Sharepoint solution programmatically

You can add a sharepoint solution file by stsadm.exe however sometime you can need to add a solution programmatically in the solution store.

Microsoft.SharePoint.Administration namespace contains many methos to add solution, Remove solution and download solution etc. The first sampe demostrate how to add a wsp solution file to solution strore without stsadm - o addsolution command. To to this I just created a new console application and add Microsoft.SharePoint.dll assembly on my console application.

SPSolution mySolution =

  SPFarm.Local.Solutions.Add(@"c:\CMS.SharePoint.CFT_RegEx.wsp");

After run this console application the solution file add programmaticlly to solution store on your SharePoint.

This example only add solution to solution store but we need addsolution and deploy it programmatically.  To do this we need to usee SPSolution.Deploy medhod.

SPSolution mySolution =

SPFarm.Local.Solutions.Add(@"c:\CMS.SharePoint.CFT_RegEx.wsp");

 

Collection<SPWebApplication> webapps = new Collection<SPWebApplication>();

SPWebApplication webapp = SPWebApplication.Lookup(new Uri("http://testsite"));

webapps.Add(webapp);

 

mySolution.Deploy(DateTime.Now, false, webapps, false);

 

Finnally your solution add and deployed on Sharepoint.

Posted: May 09 2010, 21:13 by kkaradag | Comments (1) RSS comment feed |
  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Filed under:

SPSolutionCollection and Working with Solutions - I

SPSolutionCollection class belong to Microsoft.SharePoint.Administration NamesSpace in the Microsoft.SharePoint.dll assembly. This class contains many funcinalit methods to manage your solutions. The example show us how to displaye solutions which installed your local farm.

SPSolutionCollection myColl = SPFarm.Local.Solutions;

 foreach (SPSolution mysolution in myColl)

  {

    Console.WriteLine("Solution Name : {0}, Deployed :{1}, Status {2}",

     mysolution.DisplayName, mysolution.Deployed.ToString(),

     mysolution.Status.ToString());  

  }

First line create an object contains a collection of solution in the local farm. Foreach statements loop each solutions and display their name and some properties.

Posted: May 09 2010, 20:48 by kkaradag | Comments (0) RSS comment feed |
  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Filed under:

Working with SPFile in Sharepoint

SPFile class help us working with Sharepoint list attachments. I want to explain SPFile class with some console application. The first console application working with Personel List attachments and display Attachment full name and their file size;

using (SPSite site = new SPSite("http://testsite"))

{

 using (SPWeb web = site.OpenWeb())

  {                   

   SPList list = web.GetList("/Lists/Personel/");                   

   foreach(SPListItem item in list.Items)

    {

     foreach (string name in item.Attachments)

      {

       string fullname = item.Attachments.UrlPrefix + name;

       SPFile files = item.Web.GetFile(fullname);

       Console.WriteLine("File Name {0}, fileSize {1} kb",

       fullname, files.Length);   

      }                       

   }

  }

 }

}

 

This console application connect to http://testsite/ (This is my test site, change it your test enviromet) and get Personel list. Result of display attachment full path and their size like this.

 

Sample code : SPListAttachments.rar (349.27 kb)


Download A List Attachments Programatically
For example I want to download all attechments on personel list ( no shared documents). This code sample done it.

foreach (string name in item.Attachments)

 {

   string fullname = item.Attachments.UrlPrefix + name;

   SPFile files = item.Web.GetFile(fullname);

   Console.WriteLine("Downloded file: {0} ", name);

   byte[] binFile = files.OpenBinary();

   System.IO.FileStream fstream =

   System.IO.File.Create("c:\\Temp\\" + files.Name);

   fstream.Write(binFile, 0, binFile.Length);

 

  }   

 

Sample Code : SpDownloadAttachments.rar (349.85 kb)


Download Shared Document library Programatically

 

using (SPSite site = new SPSite("http://testsite"))

    {

       using (SPWeb web = site.OpenWeb())

         {

            SPList doclib = web.Lists["Documents"];

              foreach (SPListItem item in doclib.Items)

                {

                  byte[] binFile = item.File.OpenBinary();

                  System.IO.FileStream fstream =

                  System.IO.File.Create("c:\\Temp\\" + item.File.Name);

                  fstream.Write(binFile, 0, binFile.Length);

                 }

         }

    }

Sample Code : SPDownloadDocuments.rar (349.76 kb)

Posted: Apr 26 2010, 01:02 by kkaradag | Comments (0) RSS comment feed |
  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Filed under: SharePoint 2007

Difference between SpListItem.Update and SpListItem.SystemUpdate

To update a list item we have two ways. One of them is SPListitem.Update and its is most popular way. But this method is change version history and trigger all alerts. Some times, some reason you can want to avoid change version history or triggering allerts. Like this case, SpListitem.SystemUpdate medhod help us. Because that SystemUpdate() is not changing version history.

For Example; I have a list name Personel and I want to change secont record by a console application with SPitem.Update method. Before Run this code sample my list item history like this.

 using (SPSite site = new SPSite("http://testsite"))

            {

                using (SPWeb web = site.OpenWeb())

                {

                    SPList list = web.Lists["Personel"];

                    SPListItem item = list.Items[1];

                    item["Title"] = "Sample Update with Versions.";

                    item.Update();

                    list.Update();

                }

            }

After work this Consle Application secont item version history changin like this;

The outher mathod which SystemUpdate() don't add new version history.

using (SPSite site = new SPSite("http://testsite"))

            {

                using (SPWeb web = site.OpenWeb())

                {

                    SPList list = web.Lists["Personel"];

                    SPListItem item = list.Items[1];

                    item["Title"] = "Sample Update with out add Versions";

                    item.SystemUpdate();

                    list.Update();

                }

            }

Finnaly My item history changing but not a new version number.

Download Sample Code : SPSystemUpdate.rar (348.76 kb)

Posted: Apr 25 2010, 22:31 by kkaradag | Comments (0) RSS comment feed |
  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Filed under: SharePoint 2007

Bind the List Data to a DataGird Control

To Bind the List Data to a DataGrid Control, you can write like this example webpart. This web part connect to Personel List and convert  List data to DataTable Object.

        protected override void CreateChildControls()

        {

            base.CreateChildControls();

 

            SPWeb site = SPControl.GetContextWeb(Context);

            SPList List = site.Lists["Personel"];

            SPListItemCollection  Listitems = List.Items;

            DataTable MyTable = Listitems.GetDataTable();

 

            DataGrid MyGrid = new DataGrid();

            MyGrid.DataSource = MyTable;

            MyGrid.DataBind();

            this.Controls.Add(MyGrid); 

        }

After the publish this webpart your test site via Visual Studio. it's avalibel to add as webpart like this.

 

To Download This sample application Click  BindTheListData.rar (358.57 kb)

Posted: Apr 25 2010, 22:12 by kkaradag | Comments (0) RSS comment feed |
  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Filed under: SharePoint 2007

Writing CAML Queries

The Collaborative Application Markup Language (CAML) is an XML-based query language that helps you querying and customizing Web sites based on Windows SharePoint Services. CAML Quesies has a root element named Query and Query element has two optional elements named Order by elemet and Where elemet.

<Query>

  <OrderBy>

      <!-- Query elemend to sort result data-->

  </OrderBy>

  <Where>

      <!--Query elemet to filter data-->

  </Where>

</Query>

Order By Element

Order by elemet use to sort resutl data for example, You create a Microsoft Windows SharePoint Service list named Personel. And you want to sort of data by FirstName column. To do this you can write like this CAML Query.

  <OrderBy>

       <FieldRef Name='FirstName' />

  </OrderBy

The order by element has one or more fields which you want to sort. The other detail about order by is Ascending or Descending. İf you want to sort data Descending, You must change your query <FieldRef Name='FirstName' Ascending='False' /> because that Ascending is a default key and value is True.

Where Element

The where element is the other part of CAML Queries. Where element help us filtering data.  For ex. I want to filter list data by LastName = Kemal.

<Where>

  <Eq>

    <FieldRef Name='LastName' />

    <Value Type='Text'>Kemal</Value>

  </Eq>

</Where>

And tihs example I want to add the other criteria which City = Istanbul to to this change the query a bit and add a new key <And>.

<Where>

  <And>

    <Eq>

      <FieldRef Name='LastName' />

      <Value Type='Text'>Kemal</Value>

    </Eq>

    <Eq>

      <FieldRef Name='City' />

      <Value Type='Text'>İstanbul</Value>

    </Eq>

  </And>

</Where>

The CAML Query Operators

 

Eq  Equals  == 
Neq  Not  Equals   !=
Gt Greater than   >
Geq  Greater than or equal   >=
Lt  Lower than   <
Leq  Lower than or equal   <=
IsNull  Is Null   
BeginsWith   Begins With  
Contains     

Posted: Apr 24 2010, 03:02 by kkaradag | Comments (0) RSS comment feed |
  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Filed under: SharePoint 2007