SharePoint 2010 - Terminology

SharePoint 2010 - Terminology This article provides definitions for common terms relating to SharePoint 2010.
Content type - A collection of Site Columns grouped together to define an item that you would like to store.
Farm - Installation of one or more load-balanced Web servers, and back-end servers, with a configuration database.
Farm Feature - Feature that is scoped globally for the entire server farm. For this reason, farm Features are also known as "global Features." Unlike other Feature types, a global Feature is activated by default in the farm. A farm Feature contains several elements that are critical for implementing applications and logic.

Feature - A package of Windows SharePoint Services elements that helps a user accomplish a particular goal or task. For example, one Feature might be named "My Favorite Items" and contain the following:

A custom list that stores, per user, a list of the user's favorite items. This list is created as a single hidden list per workspace when a Feature is enabled.

A custom menu item, named "Add to Favorites", that is attached to all lists and adds an item to the Favorites list.

A Web Part that shows the user the top 10 favorites, with usage and link tracking to bring true favorites to the top.

Each of these individual elements, by themselves, may not be useful, but when you enable all of them on a site they become a complete Feature that solves a particular task.

Library – Container for holding documents, pictures, lists, discussions.

List - Container in which SharePoint stores data. Much of SharePoint is stored in a list.

Page - Container for Web Part zones, and Web Parts.

Site - Container for child sites, pages, and content such as lists and document libraries.

Site Collection - Container for SharePoint sites, which exists within a specific content database. A site collection contains a top-level site and optional child sites, and is the unit of ownership, securability, and recoverability.


Site Collection Feature - Feature that is scoped at the site collection level. Typically, a site collection Feature contains items that apply to the site collection as a whole, such as Web Parts or content types that are global to the site collection.

Site Definition - A grouping of lists, features, settings, style sheets, themes master pages and a bunch of other stuff that define a web site. An example of a site definition would be Team Site, Publishing Site with Workflow, or Blank Site. You need to choose a site definition when you create a new Site Collection or a new Site.


Site Template - A customized Site Definition. Site Templates are usually used to save small changes done to a Site Definition so that they can be reused over and over again.


Web Application - IIS Web site, extended to use SharePoint, which can host site collections.

Web Application Feature - A Feature that is scoped to the Web application level.

Web Part - Components that display content on a page and are the primary means for users to customize/personalize pages.

Web Part Zone - Container for Web Parts.

Sharepont Calendar Item from and To Date through C# code

C# code to get item between from and to dates in sharepoint calendar SPList CalendarList = oSPWeb.Lists["Calendar"]; DateTime DueDate = Convert.ToDateTime(TextBox1.Text); DateTime ToDate = Convert.ToDateTime(TextBox2.Text); //string DueDate1 = SPUtility.CreateISO8601DateTimeFromSystemDateTime(DueDate); //WORKING // string query = String.Format("" + // "{0}", SPUtility.CreateISO8601DateTimeFromSystemDateTime(DueDate)); string query = String.Format(" " + "" + "" + "" + SPUtility.CreateISO8601DateTimeFromSystemDateTime(DueDate) + "" + "" + "" + "" + "" + SPUtility.CreateISO8601DateTimeFromSystemDateTime(ToDate) + "" + "" + " "); SPQuery spQuery = new SPQuery(); spQuery.Query = query; //spQuery .ViewFields = string.Concat( // "", // "", // "", // ""); //spQuery.ViewFieldsOnly = true; // Fetch only the data that we need. SPListItemCollection Calendaritemcol = CalendarList.GetItems(spQuery); int Countitems = Calendaritemcol.Count; if (Countitems > 0) { TextBox1.Text = "Item found" + Countitems.ToString(); } else { TextBox1.Text = "Not found"; } }

custom page as default page

using (SPSite oSiteCollection = new SPSite("http://MyServer/sites/MyWikiSite"))
{
    SPWeb oWebsite = oSiteCollection.OpenWeb();
    SPFolder oFolder = oWebsite.RootFolder; 
    oFolder.WelcomePage = "My Wiki Library/MyWelcome.aspx";
    oFolder.Update();
    oWebsite.Dispose();
}

sharepoint 2010 webpart expand collapse scripts

copy the below code in CEWP (content editor webpart)  any where in the page.

<script type="text/javascript">

  
function WPToggle(thisId, ImageId)
{
if (document.getElementById(thisId).style.display=="none")
{
document.getElementById(thisId).style.display="";
document.getElementById(ImageId).src = "/_layouts/images/minus.gif";
}
else
{
document.getElementById(thisId).style.display="none";
document.getElementById(ImageId).src = "/_layouts/images/plus.gif";
}
}
 
function ExpandCollapseBody()
{
var i = 1;
var WPid = "WebPartWPQ1" ;
var WPtitleid = "MSOZoneCell_WebPartWPQ1" ;
var Toggleid = "ToggleImage1" ;
do
{
try
{
document.getElementById(WPtitleid).innerHTML = '<IMG id="' + Toggleid + '" onClick="WPToggle(\'' + WPid + '\',\'' + Toggleid + '\')" alt="Expand/Collapse" style="margin:6px 5px 0px 2px; float:left; cursor:pointer;" src="/_layouts/images/minus.gif" />' + document.getElementById(WPtitleid).innerHTML ;
if (document.getElementById(WPid).style.display=="none")
{
document.getElementById(Toggleid).src = "/_layouts/images/plus.gif";
}
}
catch(err) {}
i = i + 1;
WPid = "WebPartWPQ" + i ;
WPtitleid = "MSOZoneCell_WebPartWPQ" + i;
Toggleid = "ToggleImage" + i;
} while (document.getElementById(WPid))
}
 
_spBodyOnLoadFunctionNames.push("ExpandCollapseBody()"); </script>

HTML on mouse over change image easy steps

For images src=  "please use u r path."

<html>
<body>
<table  align ="center" cellpadding ="2" cellspacing ="2">
<tr>
<td align ="center">
<a href="#nogo"  style = "textdecoration :none">
<img src="http://xxxxx/Style%20Library/newbtDe.jpg" onmouseover="this.src='http://dsfsfddsf/Style%20Library/newbt.jpg'" onmouseout="this.src='http://sssss/Style%20Library/newbtDe.jpg'" border ="0" /></br>Add New  </a>
</td>
<td align ="center">
<a href="#nogo" style = "textdecoration :none">
<img src="http://xxxx/Style%20Library/newbtDe.jpg" onmouseover="this.src='http://xxxxxx/Style%20Library/newbt.jpg'" onmouseout="this.src='http://xxxxxx/Style%20Library/newbtDe.jpg'" border ="0" /></br> Add Next </a>
</td>
</tr>
</table>
</body>
</html>

Cheers!
Deva

Sharepoint Farm

 What is a Farm?
A place where lots of animals are kept and things are grown! J In the context of SharePoint, the term 'farm' is used to describe a collection of one or more SharePoint servers and one or more SQL servers that come together to provide a set of basic SharePoint services bound together by a single Configuration Database in SQL.
Farms can range in size from having everything (all SharePoint roles and SQL server) on one machine to scaling out every individual SharePoint serve role onto dedicated sets of servers. A farm the highest administrative boundary for SharePoint and everything that happens inside SharePoint happens in a farm.
Server Services and Fault Tolerance
Within a farm, there are several services that run on one or more servers. Some of these services are mandatory and some are optional. These services provide the underpinning functionality for SharePoint. The decision around which services run on which servers will have a huge impact on your overall farm architecture and performance.
It is worth noting that some services have built-in fault tolerance and some do not. In the TechNet articles listed above, the services that have fault-tolerance are described as "Roles that can be redundant".
This table describes each service:
Service Purpose Fault Tolerance Typical Server Placement Things to note / Rules
Windows SharePoint Services Web Application (often referred to as 'Web Server' or 'WFE')This service is responsible for serving the HTML to clients and routing requests to other services in the farm.Yes, this service can exist on multiple servers.  Typically there are two or more servers running this service ion a farm. If you are using multiple servers, you must also implement a Network Load Balancing solution (NLB) to balance requests across the servers.
You must also use host headers for all web applications in this scenario. 
Office SharePoint Server Search in Query Mode (often referred to as 'Query Server') This service is responsible for executing search queries against a locally stored copy of the indexYes, this role can exist on multiple servers This service is typically placed on each Web Application server in the farm. Since this service requires a local copy of the index, appropriate disk space is needed to store the index.
Office SharePoint Server Search in Index Mode (often referred to as 'Index Server') This service is responsible for indexing all of the configured content sources, creating an index and propagating it to every Query server in the farmNo, you can only have 1 Index server for each SSP in the farm. If you have multiple SSPs (not recommended – see SSP section), you can have multiple Index servers, but they have their own set of content sources. This service is typically placed on its own dedicated server.It is possible to run both the Index and Query roles on the same server. However, in this configuration you cannot have multiple Query servers because when Index and Query are on the same server, propagation of the Index is disabled. 
Windows SharePoint Services SearchThis service is basically a slimmed down version of the Office SharePoint Server Search service which combines both the Query and Index roles into a single service.  No. If you have more than one instance of this service in a farm, it will be simply do the same thing as the other servers.This service is typically not used. If you do run this service in a MOSS farm, it is generally run on the same server as the Index server. If you have a MOSS farm, then the only reason for using this service would be to provide full text search of Help.
Excel Calculation ServicesThis service is responsible for performing calculations on Excel workbooks that are stored in the content databases.Yes, many instances of this service can exist on the same farm. This service is typically placed on each Web Application server in the farm initially.
However, this is a fairly resource intensive role; therefore, it is typically moved to a dedicated pair of servers if the load becomes too heavy.
Although this service does support fault tolerance, it does maintain session-state information, therefore users will stay on the same Excel Calculation Services server for the duration of their session.
Document Conversions Load Balancer Service This service balances document conversion requests from across the server farm. No. An application server can only have a single Document Conversions Load Balancer Service enabled.There is typically only one server running this service in a farm. This is typically placed on the Index serverFor more information on the document conversion service click here.
Document Conversions Launcher Service This service schedules and initiates the document conversions on a server.Yes. Multiple launchers can exist in the same farm.This service is typically placed on each Web Application server in the farm.If you are using multiple launcher services, they much each have the same set of document conversion applications installed.
Windows SharePoint Services Incoming E-MailThis service is responsible for receiving incoming emails and placing them in email enabled lists. Yes, this service can run on multiple servers. However this does have additional configuration. See the 'Things to note' column for details.This service is typically placed on each Web Application server in the farm.There are lots of pre-requisite steps that must be configured before using this service. Read more here.
Windows SharePoint Services Outgoing E-Mail This is not technically a SharePoint service but refers to an SMTP server which SharePoint send outbound email ton/a n/a n/a 
Central AdministrationThis service enables the central administration interface that is required for farm-wide administration No, this service can only run on one server in the farm.
UPDATE: 17 May 2009. This is an error. The CA service only runs on one server by default, however there are ways of enabling fault tolerance for this service and in actual fact you SHOULD enable fault tolerance for this service. Spence Harbar has a great article which talks all about it: http://www.harbar.net/articles/spca.aspx .The topic is also discussed on the 'From the field' blog from our PFE colleagues: http://sharepoint.microsoft.com/blogs/fromthefield/Lists/Posts/Post.aspx?List=0ce77946%2D1e45%2D4b43%2D8c74%2D21963e64d4e1&ID=60
Typically, this role is placed on either the Index server or one of the web servers. By default, the first server in the farm will run this service.The Central Administration web application does run on every Web Application server in the farm; however requests are always routed to the server that is running this service.
So what is the difference between an 'Application Server' and a 'WFE Server'?
When SharePoint is installed, you have to select one of three installation options, they are:
  • Application Server
  • Complete
  • Web Front End
There is a lot of confusion around what these options mean. An 'Application Server' is a server that is capable of running any of the services in the table above apart from the Windows SharePoint Services Web Application service. A 'Web Front End' (sometimes called a WFE) is the opposite in that it can only run the Windows SharePoint Services Web Application service. 'Complete' means that the server can run any SharePoint service.
The reason behind these options is that in some scenarios, very 'thin' web servers may be required which have a very small installation footprint. In this case, it is not desirable to install all of the DLLs etc that are required to run any service apart from the Windows SharePoint Services Web Application – these are true web servers. In my experience, this is a relatively rare scenario and only really relevant when SharePoint is being used to host high traffic internet sites.
The problem with selecting anything other than 'Complete' is that it means if you ever change your mind about what services a server can run, you'll need to re-install SharePoint on that server. For that reason alone, I would always recommend that you choose 'Complete' unless you have a very good reason to do otherwise.
This means that the terms 'Web Front End Server' and 'Application Server' are often used incorrectly. Unless your server is only running the Windows SharePoint Services Web Application service, it is an Application server. This means that the majority of servers in the majority of farms are actually Application servers.
How should I design my web applications within my farm?
I often get asked how to dedicate specific servers to specific web applications and the default answer is '"you can't"! J
One of the rules about SharePoint farms is that every server that is running the Windows SharePoint Services Web Application service has to serve every web application in the farm. It is not possible to say "Server X serves Web Application X". This means that when you create a new web application in Central Administration, the Windows SharePoint Services Timer on each server that is running the Windows SharePoint Services Web Application service creates the necessary sites and application pools in IIS to serve the web application.
What about Central Administration? .....
The Central Administration web application is no exception to this rule in that the web application does exist on every web server. However, the Central Administration service only runs on a single server and it is that server that responds to Central Administration requests. This is why the Central Administration site is always bound to a server name rather than an NLB-enabled host header.
Cross geography farms
One of the key questions is around how farms relate to different geographical data centres.
The quick answer is that you cannot run servers in the same farm across a WAN connection. For example you cannot have 1 web server in London and 1 in Reading if they are both in the same farm. This model will technically work, however it is unsupported because the web servers are very 'chatty' with the SQL server, therefore WAN connection are not seen as being good enough to support this.
What happens if I have a super-fast WAN? ....
There are some circumstances where you can span a farm over a WAN and they are as follows:
  • WFE has less than 1 millisecond(ms) latency to DB
  • WFE has less than 10 miles (16 kilometres) to DB
  • All servers on the same network segment
  • Same VLAN
  • No router switching
  • SSPs in the same datacenter
  • Servers cannot cross time zones
As a general rule of thumb you should plan to have a different farm at each data centre.
A farm's relationship with the SSP
One of the optional components in a farm is a Shared Service Provider (SSP). SSPs are optional applications that use a combination of web applications and server services to provide several shared services. The key thing to note here is that the SSP does not run on any single server within the farm, there is no such thing as an 'SSP server'. The SSP is actually an application that requires the following:
  • At least one server running Office SharePoint Server Search service in Index mode
  • An 'SSP Administration' Web Application.
  • 2 databases in the farm's SQL server.
  • Optionally, a server running the Excel Calculation Service.
Once an SSP is configured, its shared services can be provided to all of the web applications within the local farm. An SSP can also provide services to separate farms; this is called 'cross-farm Shared Services' and is very common in large deployments. You can read more about this in   MOSS Architecture and Shared Services article.
How many SSPs should I have in my farm? ....
Generally speaking it is best practice to have only one SSP per farm. It is possible to have multiple SSPs, but that configuration introduces a whole load of issues.
Each Web Application in your farm must get its Shared Services from a single SSP; it is not possible to pick and choose certain SSPs for certain shared services. Neither is it possible to say that a certain SSPs only provides certain services. The problem with this is that if you do have 2 SSPs, then you have 2 My Sites per user, 2 profiles per user, 2 sets of search indexes etc. Companies that do have this configuration, generally have to do a load of development work to keep the SSPs in sync with each other and make sure that user's are redirected to the correct SSP for their My Site.
There are only two common reasons for having multiple SSPs, they are:
  • Index Server scale. There is a recommended maximum of 50 million items per Index Server (more information click here). Since you can only have 1 Index server per SSP. If you can more than 50 million items to index, you may need to split the load across multiple SSPs.
  • Privacy. Some parts of the organization may actually want to host their own My Sites, Profiles etc and the split is seen as a good thing.
When to have multiple farms
The final thing that I get asked a lot in relation to farms is when to make the decision to have multiple farms. The general answer is that wherever possible, you should have a single farm.
However, there are several scenarios where multiple farms make sense. I covered some of this in  MOSS Architecture and Shared Services article, but here is a summary:
  • Physically separate data centres
  • Differing customisation approaches and polices
  • Differing support policies and SLAs
  • Development, staging and test environments
That will do for now! ....
I think that is quite enough for one article and I've covered most of the questions I hear a lot when chatting to people in the field.
I'm keen to hear about areas that I may have missed so please use the comments to log your own grey areas around SharePoint farms and maybe I'll do a part 2 covering the common themes.

Powershell script caml query date -how to get data based on modified date

$now = (Get-Date).AddDays(-1);
   $lastrun_converted = [microsoft.sharepoint.utilities.sputility]::CreateISO8601DateTimeFromSystemDateTime($now);
   write-host $lastrun_converted;
   $camlsource = "<Where><Geq><FieldRef Name='Modified'/><Value Type='DateTime' IncludeTimeValue='True'>$lastrun_converted</Value></Geq></Where>"
  
   #$query=new-object Microsoft.SharePoint.SPQuery
       $queryfromsource=new-object Microsoft.SharePoint.SPQuery  
   #$query.ViewAttributes = "Scope=`"Recursive`""
 
   $queryfromsource.ViewAttributes = "Scope=`"Recursive`""
   $queryfromsource.Query=$camlsource

Using Powershell Script update sahrepoint library to sharepoint list item with attachemnt

#cls
#if((Get-PSSnapin | Where {$_.Name -eq "Microsoft.SharePoint.PowerShell"}) -eq $null) {
#    Add-PSSnapin Microsoft.SharePoint.PowerShell;
#}


Remove-PSSnapin Microsoft.SharePoint.PowerShell -erroraction SilentlyContinue
Add-PSSnapin Microsoft.SharePoint.PowerShell -erroraction SilentlyContinue
     try 
   {    

 #$srcListSiteUrl = "XXXXXX"   
     #$SourceListName = "Outlookupdate"     
 
 $dstListSiteUrl = "XXXXXXX"   
    $DestinationListName = "OutlookupdateReceiver"
     
    $keyColumnInternalName = "Name";
 $keyColumnInternalName2= "Status"; 
 $keyValue2 ="Completed";    
 #$sourceListWeb = Get-SPWeb -identity $srcListSiteUrl   
   #$sourceListUrl = $sourceListWeb.ServerRelativeUrl + $SourceListName;
  #$sourceListUrl = $sourceListWeb.ServerRelativeUrl +  $SourceListName;     
  


 $dstListWeb = Get-SPWeb -identity   $dstListSiteUrl  
   $destinationListUrl = $dstListWeb.ServerRelativeUrl + "/lists/" + $DestinationListName;      

 #$SourceList = $sourceListWeb.GetList($sourceListUrl);    


 $sourceWebURL = "XXXXXX/"
 $sourceListName = "Outlookupdate"
 $spSourceWeb = Get-SPWeb $sourceWebURL
 $SourceList = $spSourceWeb.Lists[$sourceListName]

 write-host  $sourceListUrl 


        $DestinationList = $dstListWeb.GetList($destinationListUrl);
  write-host "soruce destination set "

   #$freq = 30 # in minutes
   #$now = get-date
   #$lastrun = $now.AddMinutes($freq)


  
   $now = (Get-Date).AddDays(-1);
   $lastrun_converted = [microsoft.sharepoint.utilities.sputility]::CreateISO8601DateTimeFromSystemDateTime($now);
   write-host $lastrun_converted;
   $camlsource = "<Where><Geq><FieldRef Name='Modified'/><Value Type='DateTime' IncludeTimeValue='True'>$lastrun_converted</Value></Geq></Where>"
  
   #$query=new-object Microsoft.SharePoint.SPQuery
       $queryfromsource=new-object Microsoft.SharePoint.SPQuery  
   #$query.ViewAttributes = "Scope=`"Recursive`""
 
   $queryfromsource.ViewAttributes = "Scope=`"Recursive`""
   $queryfromsource.Query=$camlsource
   #$query.Query=$camlsource
   #$result = $list.GetItems($query)

     
        #$sourceSPListItemCollection = $SourceList.GetItems();
    
  $sourceSPListItemCollection = $SourceList.GetItems($queryfromsource);
  write-host $sourceSPListItemCollection.Count; 
  foreach($srcListItem in $sourceSPListItemCollection)  
    {   
       write-host  $srcListItem
   #CAML query of the common column (generally the title column or any unique column)        
 
   $keyValue = $srcListItem[$keyColumnInternalName] 
          write-host  $keyValue
  
                  # $camlQuery = "<Where>           
    # <Eq>           
    #  <FieldRef Name=" + $keyColumnInternalName + " />              
    # <Value   Type='Text'>" + $keyValue + "</Value>           
    # </Eq>         
    # </Where>"       
  
      $camlQuery = "<Where>
      <And>
      <Eq>
      <FieldRef Name=" + $keyColumnInternalName + " />
      <Value Type='Text'>" + $keyValue + "</Value>
      </Eq>
      <Neq>
      <FieldRef Name=" + $keyColumnInternalName2 + " />
      <Value Type='Text'>" + $keyValue2 + "</Value>
      </Neq>
      </And>
      </Where>"


   $spQuery = new-object Microsoft.SharePoint.SPQuery        
   $spQuery.Query = $camlQuery        
   $spQuery.RowLimit = 1      
  
   #check if the item is already present in destination list        
    
   $destItemCollection = $DestinationList.GetItems($spQuery)        
  
    write-host "destination count" 
    write-host $destItemCollection.Count
   if($destItemCollection.Count -gt 0)        
  
   {            
    
    write-host "list item already exists, updating "           
     
    foreach($dstListItem in $destItemCollection)   
          
     {               
           foreach($spField in $dstListItem.Fields)                
        
             {                
    
        if ($spField.ReadOnlyField -ne $True -and  $spField.InternalName -ne "Attachments")   
                 {                     
         $dstListItem[$spField.InternalName] = $srcListItem[$spField.InternalName];                 
            }
              
          }                
       # Handle Attachments
    
        write-host "Handle Attachments  " 
    
       foreach($leafName in $srcListItem.Attachments)       
           
          {          
      
        write-host "inside" 
       
        #file source list
        $filename1 =  "http://XXXX/" +  $keyValue
        write-host $filename1;
             
         $spFile = $SourceList.ParentWeb.GetFile($filename1);     
        $dstListItem.Attachments.Add($filename1, $spFile.OpenBinary());  
       
              
     
                }  
        $dstListItem["Status" ] ="Completed";           
      
        $dstListItem.Update()           
        }   
   
       }   #if conditon end else start 
       
     
      else      
        {     
             write-host "adding new item"            
      
              
      }     
       }      
     }   
    
    catch    
     
     {    write-host $_.exception 
         }    
     
    finally 
        
     { 
      if($sourceListWeb -ne $null)
      {$sourceListWeb.Dispose()}        
    
      if($dstListWeb -ne $null)
      {   $dstListWeb.Dispose()} 
         }

Using powershell script update Sharepoint library to library.


Remove-PSSnapin Microsoft.SharePoint.PowerShell -erroraction SilentlyContinue
Add-PSSnapin Microsoft.SharePoint.PowerShell -erroraction SilentlyContinue
     try 
   {     

     
 $keyColumnInternalName = "Name";
 $keyColumnInternalName2= "Status"; 
 $keyDestinationColumnInternalName ="Name1";
 $keyValue2 ="Completed";    

  


 $sourceWebURL = "http://XXXXI/"
 $sourceListName = "Outlookupdate"
 $spSourceWeb = Get-SPWeb $sourceWebURL
 $SourceList = $spSourceWeb.Lists[$sourceListName]
  

 $dstListWebURL = "http://XXXXX/"
 $DestinationListName = "OutlookReceiverLibrary"
 $spDestinationWeb = Get-SPWeb $dstListWebURL
 $DestinationList = $spDestinationWeb.Lists[$DestinationListName]




        #$DestinationList = $dstListWeb.GetList($destinationListUrl);
 #$DestinationList = $dstListWeb.List($destinationListUrl);
  write-host "soruce destination set "

   #$freq = 30 # in minutes
   #$now = get-date
   #$lastrun = $now.AddMinutes($freq)
  
   $now = (Get-Date).AddDays(-1);
   $lastrun_converted = [microsoft.sharepoint.utilities.sputility]::CreateISO8601DateTimeFromSystemDateTime($now);
   write-host $lastrun_converted;
   $camlsource = "<Where><Geq><FieldRef Name='Modified'/><Value Type='DateTime' IncludeTimeValue='True'>$lastrun_converted</Value></Geq></Where>"
  
   #$query=new-object Microsoft.SharePoint.SPQuery
       $queryfromsource=new-object Microsoft.SharePoint.SPQuery  
   #$query.ViewAttributes = "Scope=`"Recursive`""
 
   $queryfromsource.ViewAttributes = "Scope=`"Recursive`""
   $queryfromsource.Query=$camlsource
   #$query.Query=$camlsource
   #$result = $list.GetItems($query)

     
        #$sourceSPListItemCollection = $SourceList.GetItems();
   $sourceSPListItemCollection = $SourceList.GetItems($queryfromsource);
  write-host $sourceSPListItemCollection.Count; 
  foreach($srcListItem in $sourceSPListItemCollection)  
    {   
       write-host  $srcListItem
   #CAML query of the common column (generally the title column or any unique column)        
 
   $keyValue = $srcListItem[$keyColumnInternalName]
    # $keyValue =$keyValue.split(".")[0];
          write-host  $keyValue
  
                  # $camlQuery = "<Where>           
    # <Eq>           
    #  <FieldRef Name=" + $keyColumnInternalName + " />              
    # <Value   Type='Text'>" + $keyValue + "</Value>           
    # </Eq>         
    # </Where>"       
  
      $camlQuery = "<Where>
      <And>
      <Eq>
      <FieldRef Name=" + $keyDestinationColumnInternalName + " />
      <Value Type='Text'>" + $keyValue + "</Value>
      </Eq>
      <Neq>
      <FieldRef Name =" + $keyColumnInternalName2 + " />
      <Value Type='Text'>" + $keyValue2 + "</Value>
      </Neq>
      </And>
      </Where>"


   $spQuery = new-object Microsoft.SharePoint.SPQuery        
   $spQuery.Query = $camlQuery        
   $spQuery.RowLimit = 1      
  
   #check if the item is already present in destination list        
    
   $destItemCollection = $DestinationList.GetItems($spQuery)        
  
    write-host "destination count" 
    write-host $destItemCollection.Count
   if($destItemCollection.Count -gt 0)        
  
   {            
    
    write-host "list item already exists, updating "           
     
    foreach($dstListItem in $destItemCollection)   
          
     {               
           foreach($spField in $dstListItem.Fields)                
        
             {                
    
        if ($spField.ReadOnlyField -ne $True -and  $spField.InternalName -ne "Attachments")   
                 {                     
         $dstListItem[$spField.InternalName] = $srcListItem[$spField.InternalName];                 
            }
              
          }                
       # Handle Attachments
    
        write-host "Handle Attachments  " 
    
       foreach($leafName in $srcListItem.Attachments)       
           
          {          
      
        write-host "inside" 
       
        #file source list
        $filename1 =  "http:// XXXXX/" +  $keyValue
        write-host $filename1;
             
         $spFile = $SourceList.ParentWeb.GetFile($filename1);     
        #$dstListItem.Attachments.Add($filename1, $spFile.OpenBinary());  
       
              
     
                }
        $dstListItem["UploadedDocument" ] = $filename1;             
        $dstListItem["Status" ] ="Completed";           
     
        $dstListItem.Update()           
        }   
   
       }   #if conditon end else start 
       
     
      else      
        {     
             write-host "adding new item"            
      
              
      }     
       }      
     }   
    
    catch    
     
     {    write-host $_.exception 
         }    
     
    finally 
        
     {  
      if($spDestinationWeb -ne $null)
      {
      $spDestinationWeb.Dispose();}
     
      if($spSourceWeb -ne $null)
      {
      $spSourceWeb.Dispose(); }
       
         }

Import the .csv file, and specify manually the headers

 Import the .csv file, and specify manually the headers, without column name in the file  $contents = Import-CSV ‘C:\Input.csv' -header("Employee ID", "Employee Name")# Web URL $webURL = “SITEURL here” $web = Get-SPWeb -Identity $webURL $listName = "ListNameHere"$list= $web.Lists["$listName"] # Iterate for each list column foreach ($row in $contents ) {     $item = $list.Items.Add();     $item["Employee ID"] = $row.GroupName     $item["Employee Name"] = $row.Permissions     $item.Update() } Write-Host -ForegroundColor green "List Updated Successfully"$web.Dispose()

http://sharepoint-works.blogspot.in/2013/01/import-excel-to-sharepoint-list-using.html

Powershellscript to import excel

 

http://podlisk.wordpress.com/2011/11/20/import-excel-spreadsheet-into-powershell/
How to Import Excel spreadsheet into PowerShell
20 11 2011
In most of the cases, it will be more than sufficient to use very well-known PowerShell command – Import-Csv.
But… there is always a “but”… For every manipulation with every Excel (.XLS, .XLSX) spreadsheet, first you will have to export its content to .CSV. This is minimal requirement. After it, every manipulation with the original file, will cause you to export the file again and again. Finally, what would you do with the Unicode characters? While exporting to .CSV, these characters will be probably lost.
Bottom line, the function presented below – Import-Excel – will help you to load the native Excel spreadsheet directly to array of PowerShell objects. This function, loaded into PowerShell, could be used pretty straight-forward with the syntax described:
Import-Excel [-FileName]:Path [-WorksheetName:"Name"] [-DisplayProgress:$true|$false]
-FileName – path to the Excel file. Since the code uses Excel Com-object, any format supported by local installation of Excel is compatible
-WorksheetName – name of the spreadsheet to load. If not name declared, the first one will be loaded
-DisplayProgress – switch $true or $false to display or not the progress of the load process
The function returns array of objects, where each property name, represented by first row of the Excel spreadsheet.
Finally, the code with few examples right after:
function Import-Excel
{
  param (
    [string]$FileName,
    [string]$WorksheetName,
    [bool]$DisplayProgress = $true
  )

  if ($FileName -eq "") {
    throw "Please provide path to the Excel file"
    Exit
  }
  if (-not (Test-Path $FileName)) {
    throw "Path '$FileName' does not exist."
    exit
  }
  $FileName = Resolve-Path $FileName
  $excel = New-Object -com "Excel.Application"
  $excel.Visible = $false
  $workbook = $excel.workbooks.open($FileName)
  if (-not $WorksheetName) {
    Write-Warning "Defaulting to the first worksheet in workbook."
    $sheet = $workbook.ActiveSheet
  } else {
    $sheet = $workbook.Sheets.Item($WorksheetName)
  }
 
  if (-not $sheet)
  {
    throw "Unable to open worksheet $WorksheetName"
    exit
  }
 
  $sheetName = $sheet.Name
  $columns = $sheet.UsedRange.Columns.Count
  $lines = $sheet.UsedRange.Rows.Count
 
  Write-Warning "Worksheet $sheetName contains $columns columns and $lines lines of data"
 
  $fields = @()
 
  for ($column = 1; $column -le $columns; $column ++) {
    $fieldName = $sheet.Cells.Item.Invoke(1, $column).Value2
    if ($fieldName -eq $null) {
      $fieldName = "Column" + $column.ToString()
    }
    $fields += $fieldName
  }
 
  $line = 2
 
 
  for ($line = 2; $line -le $lines; $line ++) {
    $values = New-Object object[] $columns
    for ($column = 1; $column -le $columns; $column++) {
      $values[$column - 1] = $sheet.Cells.Item.Invoke($line, $column).Value2
    } 
 
    $row = New-Object psobject
    $fields | foreach-object -begin {$i = 0} -process {
      $row | Add-Member -MemberType noteproperty -Name $fields[$i] -Value $values[$i]; $i++
    }
    $row
    $percents = [math]::round((($line/$lines) * 100), 0)
    if ($DisplayProgress) {
      Write-Progress -Activity:"Importing from Excel file $FileName" -Status:"Imported $line of total $lines lines ($percents%)" -PercentComplete:$percents
    }
  }
  $workbook.Close()
  $excel.Quit()
}
Usage examples:
[PS] C:\>$reportLines = Import-Excel C:\Document\my-report.xls
- will import the content of the first spreadsheet from the file, found at “C:\Document\my-report.xls” into $reportLines variable
[PS] C:\>$users = Import-Excel C:\Document\users.xlsx -WorksheetName:"HQ"
- will import the content of the first “HQ” spreadsheet from the “C:\Document\users.xlsx” file into $users variable
I hope this will be helpful. Enjoy the code! Any comments are more than welcome.

SPFX - HTTPClient - Curd Operations - SharePoint list.

  Create solution in the name of SpfxCrud. ISpfxCrudProps.ts export interface ISpfxCrudProps {   description : string ;     context : an...