Microsoft has published a SharePoint 2010 Code sample pack. Containing 101 Codes samples !
If I had that when i began to learn SharePoint, it would have saved me a lot of time.
Language are C# and VB, for SharePoint on premise AND Online !!
Some of really useful features are, for a sharepoint developper :
Programmatically create masterpage for Sharepoint 2010, and apply the masterpage programmatically thanks to a Feature Event Receiver
Programmatically create content type for Sharepoint 2010
Create List definition for SharePoint 2010
Or some advanced one :
Use Azure, WCF, Sharepoint Web service in Webpart, event receiver or Jobtimer
Here the complete list :
SharePoint 2010 Leveraging HTML5 Objects in SharePoint
SharePoint 2010 Developing JQuery-Enabled Web Parts
I’m creating SPListItem Programmatically (create elements in a list) and when the item.update(); is called by the code, the following error is thrown : “Erreur : Valeur de date/d’heure non valide.Un champ de date/d’heure contient des données non valides. Vérifiez la valeur, puis réessayez” or in english : “SPException : invalid date/time…”
What could be the problem ?
The date format is not correct
The date is not correct (minimum date for SharePoint ?)
Solving the problem
I’m giving an example of an incorrect date value “01/01/0001 00:00:00” :
1: SPList list = web.Lists["myList"];
2:
3: SPListItem item;
4:string date = "01/01/0001 00:00:00";
5:
6: item = list.Items.Add();
7:
8: item["currentDate"] = date;
9:if (DateTime.TryParse(row["currentDate"].ToString(), out dateTime) == true)
Based on this excellent tutorial from kirk Evans : http://blog.evepoints.com/2010/11/add-video-sharepoint-2010-blog.html
This will allow you to add youtube video in a blog content.
Basic sharepoint feature permit you to add the video by modifying the HTML code, from the Insert HTML button of sharepoint, but that is not really user friendly.
Preview, on a blog post :
New youtube embedded format ?
I modified one of the method of Kirk Evans in order to accept the new youtube embedded video format. The new embedded video format looks like this :
New youtube embedded code for video (<iframe) :
Old youtube embedded code for video (object) :
So to update Kirk Evans code, replace the last method by :
After patching SharePoint 2010, with the cumulative Update of December, you could get some issues if you created custom content type by Visual Studio, using programmatically method (C#) :
The document content type is missing
The error prompting on sharepoint is : 0x0101 is missing
The element content type is missing :
The error prompting on sharepoint is : 0x01 is missing
The error prompting : The parent content type specified by content type identifier 0x0…. does not exist
Solution : Here is the content type declaration in Visual Studio, this content type is added in a feature :
After the patch, this declaration won’t work, you’ll correct it by deleting “Inherits” and “Overwrite” attribute. Inherits=”True” Overwrite=”True”
[Edit 01/03/2012] : You’ll need to redeploy the .wsp package, or to modify directly in the /14 folder, the deployed content type + iisreset (not tested).
Did you have any other issue after the cumulative update of december 2011 for SharePoint 2010 ?
I got the following error message in visual studio during programing :
“The file has been modified by … unknown”
It was because i called two times (by error) the item.update(); method.
This could happen as well when you code an event receiver (sometime happening when you do something on a list, web, site….) and you use item.update(), in order to fix that :
call and disable event firing before your code with : base.EventFiringEnabled = false;
update your item by calling item.systemUpdate(false);
enable event firing with : base.EventFiringEnabled = true;
We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.Ok