Posts

Showing posts from 2011

Export SharePoint 2010 sites list to Excel File

Image
How to get the SharePoint 2010 sites list to Excel using  Powershell ? Go to  SharePoint 2010 Management Shell . You have to open the Web Application, then the Site Collection, after Select the Fields and Export to Excel (csv file) $Get-SPSite | Get-SPWeb | Select url,title | Export-Csv All this on one line in PowerShell, just think how much time it saves time instead of building a console application. Yours Roi

Sharepoint 2007 Crawl Never Ends - Always Status Crawling

Image
I had "Not Stopped the Search Index Crawler " case in SharePoint 2007 (in “ Crawling ” status indefinitely) and doesn't respond to stop requests I had not stopped the search case " Stop Crawl " But nothing - stuck " Stopping " The solution:  Enter the following stsadm commands : execadmsvcjobs , osearch -action stop, -o osearch -action start -role Index C:\>stsadm -o  execadmsvcjobs Executing . Operation completed successfully. C:\ >stsadm -o osearch -action stop The Office SharePoint Server Search service was successfully stopped. C:\>stsadm -o osearch -action start -role Index The Office SharePoint Server Search service was successfully started. Now you need to do - Reset all craweld content Now re-run the indexing, this should solve the problem. Hope I helped, Roi

SPListItem​Collection to Linq List

Image
This time you code gives us extension to  SPListItemCollection object. SPListItem​Collection to Linq List If you want to work with the object of SPListItemCollection using linq - The following code can help public   static   List < SPListItem > ToList( this   SPListItemCollection  items) {      IEnumerable < SPListItem > itemsContiens = items.OfType< SPListItem >();      return  itemsContiens.ToList< SPListItem >(); } Yours... Roi

The underlying connection was closed: An unexpected error occurred on a receive

Image
When I tried to access an external server on the server side (not the organization) through the code (in my case web-part of sharepoint) I got an error: The code is simple code: public   XmlDocument  GetXmlData() {      XmlDocument  document =  new   XmlDocument ();      //Now load the XML Document     document.Load( this .url); // fall      return  document; } The error I got it:    The underlying connection was closed: An unexpected error occurred on a receive.    Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host.    at System.Net.HttpWebRequest.GetResponse()    at System.Xml.XmlDownloadManager.GetNonFileStream(Uri uri, ICredentials credentials)    at System.Xml.XmlDownloadManager.GetStream(Uri uri, ICredentials crede...

Update SharePoint fields on Client-Side with spservices

Image
This time I will present a client-side code (JavaScript) - which updates a list of fields without having to insert the data (edit) into the form. All you need is another class from beloved and familiar - jquery that Called- spservice :  http://spservices.codeplex.com/ It works in 2007 and 2010 because the code in the form ajax turns  to the sharepoint web-service. (Although in 2010 we have the " Client Object Model "). The following code built two objects - an image and textbox I make an update of the field after clicking on the image, and then I prevent users from updating again. Please note, I use the method of spservice SPUpdateMultipleListItems . The method get the following variables: webURL, listName, CAMLQuery, batchCmd, valuepairs, debug ...    < input   type ="text"   id ="txt <% = this.UniqueID %> "   class ="myClass1"   value =" <% = likeValue %> "   />    < img   ...

Barrier: synchronizes threads in freamwork 4

Image
Question: How to build a barrier like a a traffic light for threads and synchronize them? Solution: That's what brought us to the barrier of  framework 4 ! I built code that gets three threads and trying to sync. There are three types of situations: 1. Green - do not get their delayed and continue normal (driving). 2. Yellow - paused for a second and then goes through the green . 3. Red - delayed for 2 seconds and then goes through the yellow color. The following code shows a good example of a barrier. Sync object is a barrier. It causes delay by type situation. Join activates the trigger of the action ( TrafficLightsAction ). using  System; using  System.Collections.Generic; using  System.Linq; using  System.Text; using  System.Threading; using  System.Threading.Tasks; namespace  BarrierTrafficLights {       class   Program      {    ...

Server is too busy

Image
This time I came across a seemingly simple problem I received the following message at the portal Server is too busy CPU processor of Windows SharePoint Server yield was 100% !!! CPU 100% Thanks to RRaveen - How to resolve the “Server Too Busy” error in asp.net , I understand what the problem. Previously explained how to solve a problem of " large data transfer in web service " I showed how to change executionTimeout on the web.config To correct the error - You need to change the variable " executionTimeout " to 3600 (this an hour because it a number of seconds - 60 * 60 = 3600) Go to the web.config and set the tag httpRuntime the following code on the " system.web " tag. < system.web >   < httpRuntime executionTimeout = " 3600 " maxRequestLength = " 51200 " > ... This should solve the problem. If not, Should reduce the number (the default is 110 seconds). thanks, Roi

value does not fall within the expected range

Image
Did you have the following situation ? Access to the sharepoint list . Operations in any action , then try to contact list again , but this time , and receive the following message value does not fall within the expected range. What to do? You need to refrash the web and the list! Use this code: /// <summary> /// Refresh a List /// </summary> /// <param name="list"></param> /// <returns></returns> public static SPList RefreshList( SPList list) {      return RefreshWeb(list.ParentWeb).Lists[list.ID]; } /// <summary> /// Return the web /// </summary> /// <param name="web"></param> /// <returns></returns> public static SPWeb RefreshWeb( SPWeb web) {      web = new SPSite (web.Site.ID).OpenWeb(web.ID);      web.AllowUnsafeUpdates = true ;    ...

Update SharePoint Master Page with Code (C#)

This time I brought a code which allows you to update SharePoint master page on console project (with C#.Net and not with SPD). We look for a site that starts with "http://moss2007/Test-Base/", check that the masterpage had the old version , and we will update the new masterpage . For this subject, we'll have to save the masterpage on a physical file  (C:). In addition, we have to approve the masterpage. using System; using System.Collections. Generic ; using System.Text; using System.IO; using Microsoft.SharePoint; using Microsoft.SharePoint.Publishing; using Microsoft.SharePoint.Administration; namespace Roi.SharePoint.UpdateMasterPage {   class Program   {     private const string oldMasterPage = "workgroup.master" ;     private const string newMasterPage = "NewMaster.master" ;     static void Main( string [] args)     {       SPWebApplicatio...

Study sharepoint with videos

This time I'll introduce you to learn sharepoint sites with video clips SharePoint 2010 Enterprise Content Management Implementers' Course (technet). SharePoint 2010 for Internet Sites Implementers' Course (technet). Video Center | SharePoint 2010 Development (msdn). SharePoint 2007 How-To App (iPhone) (informmIT). How to study for 70-573 Microsoft SharePoint 2010, Application Development (ybbest). SharePoint 2010 Advanced IT Professional Training (Let's Share Our Expertise). SharePoint 2010 Advanced Developer Training (Let's Share Our Expertise). Video demos and training for SharePoint Server 2010 (technet). TechNet Virtual Labs: SharePoint Products and Technologies (technet). Yours, Roi

Daily alerts do not work at SharePoint

Did you encounter a problem alerts list ? Something strange happened to me ( hurray sharepoint ...). A lerts were working fine - just a list daily alerts stopped working . I really do not know why this list . After searching on google - I realized that take care stsadm commands such problems . All you have to do is make those commands in the order ( and of course replace the http://YOURSITE to your site ) . stsadm -o updatealerttemplates -url http://YOURSITE -f "c:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\XML\alerttemplates.xml" -LCID 1037 stsadm.exe -o setproperty -url http://YOURSITE -pn alerts-enabled -pv true stsadm.exe -o setproperty -url http://YOURSITE -pn job-immediate-alerts -pv "every 5 minutes" I would like to thank Noam - helped me find the solution and fix the problem. Your, Roi

How to Convert Image to Byte Array or Bitmap

This time I present code that can help you work with images ( System.Drawing ). I showed how to convert Image to Byte Array and how to convert Image to Bitmap . here is the code: /// <summary> /// Image Converter from Image to byte array /// </summary> /// <param name="img">Image</param> /// <returns>byte</returns> public static byte [] ImageToByte( Image img) {      ImageConverter converter = new ImageConverter();      return ( byte [])converter.ConvertTo(img, typeof ( byte [])); } /// <summary> /// Image Converter from Image to Bitmap /// </summary> /// <param name="img"></param> /// <returns></returns> public static Bitmap ImageToBitmap( Image img) {      ImageConverter converter = new ImageConverter();      return ( Bitmap )converter.ConvertTo(img, typeof ( Bitmap )); } Yours, Roi

Whether the current user belongs to a SharePoint group policy

This time I will present the work Code which provides the current user has identification.      #region Permission      /// <summary>      /// return true is the CurrentUser has Permission in CurrentWeb      /// groupNames is the groups that split by ';'.      /// </summary>      /// <param name="groupNames"></param>      /// <returns></returns>      public static bool IsUserHasPermission( string groupNames)     {       SPUser user = SPContext.Current.Web.CurrentUser;       SPWeb web = SPContext.Current.Web;        return IsUserHasPermission(groupNames,web,user);     }      /// <summary>      /// re...

Error occurred in deployment step 'Recycle IIS Application Pool': The local SharePoint server is not available. Check that the server is running and connected to the SharePoint farm

Image
Did you receive the following error when you tried to compile a project of SharePoint 2010? Error occurred in deployment step 'Recycle IIS Application Pool': The local SharePoint server is not available. Check that the server is running and connected to the SharePoint farm. So - the solution is simple You should be Full Permission on the SharePoint Farm - including a data base (DB owner). After it is completed - open the visual studio as administrator. Cheers, Roi Kolbinger

Date and Time in JavaScript

Image
And this time I will present a snippet of code in javascript that shows the date and time. You can put it wherever you like - in nearly every segment SharePoint Designer or in the Content Editor WebPart. The JS code shows Date and Time <!-- Clock --> < script language ="JavaScript"> var clockID = 0; function UpdateClock() {    if (clockID) {       clearTimeout(clockID);       clockID   = 0;    }    var tDate = new Date();    var roiClock = window.document.getElementById( "roiClock" );    roiClock.innerHTML = ""     + tDate.toLocaleDateString()     + "&nbsp;&nbsp;&nbsp;&nbsp;"      + tDate.getHoursTwoDigits() + ":"      + tDate.getMinutesTwoDigits()    clockID = setTimeout( "UpdateClock()" , 6000); } function StartClock() {    clock...