Pages

IMG

Affichage des articles dont le libellé est Visual Studio. Afficher tous les articles
Affichage des articles dont le libellé est Visual Studio. Afficher tous les articles

[Visual Studio] Server explorer doesn’t show SharePoint site

mercredi 4 décembre 2013

 

If Server explorer or SharePoint manager don’t list your sharepoint servers check those pre requisite :

  1. Your account requires to be farm account
  2. Your account requires to be administrator of central administration
  3. Your account requires to be administrator of the site collections
  4. Run as administrator Visual studio or SharePoint manager

[Error fix] Referenced assembly does not have a strong name

 

When adding a dll to the visual studio project, this error comes out “referenced assembly does not have a strong name”.

You need to sign the current project :

  1. Navigate to the project properties
  2. Check the checkbox sign the assemble

[SharePoint 2010 Developpement] Getting started with SharePoint 2010 Developpement, thanks to SharePoint 2010 – 101 Codes Samples (MSDN)

jeudi 23 février 2012

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 !!
image
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

[SharePoint 2010] - Cumulative Update December Issues –Document content type is missing after programmatically have created Content Type

mardi 31 janvier 2012

Issues :


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

[Sharepoint 2010 - Error Fixing] The file has been modified by ... unknown

mercredi 30 novembre 2011

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;

[SharePoint 2010 - Developpement] Add current user to person field default value with event receiver ItemAdding–SharePoint 2010

jeudi 29 septembre 2011

I wanted to set a person field default value with my current user, but that doesnt exist in sharepoint.
What i did is :
  • I created an event receiver
  • I checked if it was my library
  • Then i set the person value thanks to the ItemAdding event firing
   1: /// <summary>
   2:        /// An item is being added.
   3:        /// </summary>
   4:        public override void ItemAdding(SPItemEventProperties properties)
   5:        {
   6:            SPSecurity.RunWithElevatedPrivileges(delegate()
   7:            {
   8:                try
   9:                {
  10:                    this.EventFiringEnabled = false;
  11:                    base.ItemAdded(properties);
  12:                    if (properties.List.RootFolder.Name == "libraryInternalName")
  13:                    {
  14:                        SPWeb web = properties.List.ParentWeb;
  15:                        SPList List = properties.List;
  16:                        //replace the id by your person colomn
  17:                        SPField fld = List.Fields[new Guid("03457d42-31a3-4088-b9af-4e3f2e368545")];
  18:                        SPUser usr = web.CurrentUser;
  19:                        SPFieldUserValue defValue = new SPFieldUserValue();
  20:                        defValue.LookupId = usr.ID;
  21:                        fld.DefaultValue = defValue.ToString();
  22:                        fld.Update();
  23:                        List.Update();
  24:                    }
  25:  
  26:                }
  27:                catch (Exception)
  28:                {
  29:                }
  30:                finally
  31:                {
  32:                    this.EventFiringEnabled = true;
  33:                }
  34:            });
  35:        }

[SharePoint 2010 - Developpement] Publish and approve file programmatically sharepoint 2010

vendredi 1 juillet 2011

I created a module which deploy a file (itemStyle for a ContentQueryWepPart), and i wanted to publish and approve it directly programmatically.
In the feature of your module :
  • Create an event Receiver
  • Add this code :
   1: public override void FeatureActivated(SPFeatureReceiverProperties properties)
   2: {
   3:     publishItemStyle(properties);
   4: }
   5:  
   6: private void publishItemStyle(SPFeatureReceiverProperties properties)
   7: {
   8:     try
   9:     {
  10:         SPWeb web = (SPWeb)properties.Feature.Parent;
  11:         SPFile file = web.GetFile("Style Library/Xsl Style Sheets/ItemStyle.xsl");
  12:  
  13:         if (file.Level == SPFileLevel.Checkout)
  14:             file.CheckIn("", SPCheckinType.MajorCheckIn);
  15:         if (file.Level == SPFileLevel.Draft)
  16:         {
  17:             if (file.DocumentLibrary.EnableModeration) file.Approve("");
  18:             else file.Publish("");
  19:         }
  20:         file.Update();
  21:     }
  22:     catch (Exception e)
  23:     {
  24:     }
  25: }

Hope this help,

[SharePoint 2010 - Developpement] Create a Content Query Webpart in Site Definition (onet.xml), with dynamic site Url

lundi 27 juin 2011

I wanted to create a webtemplate with content query webpart in pages. Those webpart had to have the current site url. So I used the hack “~Site” in the properties of the webpart
Here are the step for it :

[SharePoint 2010 - Error fixing] Failed to extract the cab file in the solution (sharepoint 2010)

mercredi 15 juin 2011

When I tried to deploy my Visual Studio Solution for a Sharepoint 2010 site collection, I had that error :
failed to extract the cab file in the solution


What solved that problem :
  • I had parenthesis() in some List instance Names. So I renamed it.
Generally, explore your package, by going in Packaging Explorer of Visual Studio, and look for elements with parenthesis, ^ or special caracter.

[SharePoint 2010 - Developpement & Administration] Getting started with Sharepoint 2010 : useful Tools

mercredi 8 juin 2011

In order to help you to build and debug your sharepoint, you’ll need some tools

Sharepoint Manager 2010 (object model explorer)


A great tool permitting you to explore your Sharepoint Websites, content types, fields, library :
http://spm.codeplex.com/
There is a 2007 version available

Caml Builder

Generate CAML Query in a simply way
http://www.u2u.net/res/Tools/CamlQueryBuilder.aspx

[EDIT 04/02/2012]

 View Sharepoint Log in a better way :

Those log viewers enable the filtering, sorting function, really useful to search an error from its correlation ID

Uls Viewer

See logs of sharepoint in a better way. It also permits you to only display the errors, and search correlation id link to the error message
http://archive.msdn.microsoft.com/ULSViewer

and even better


SharePoint LogViewer

Same functions as Uls viewer, but the presentation is much better

http://sharepointlogviewer.codeplex.com/

[SharePoint 2010 - Developpement] Getting started with Visual Studio Tools for Sharepoint 2010

In order to help you to build your sharepoint, you’ll need some Visual Studio Tools

Generate page layout from a content type

 

When you create a Page layout heriting from a content type and you want to display the metadata on the page, you could use this great extension for Visual studio in order to generate the page layout.
http://visualstudiogallery.msdn.microsoft.com/en-us/990bd0c8-a55b-4643-a35d-88136594c3d9
Here a post from Waldek MastyKarz to explain how it works

Cks Dev Server

Add of lot of feature really useful, the one I use :
  • Permit you to generate page code for site definition (onet.xml)
  • Reboot IIS
  • Create Site definition in my current project, instead of creating a Site definition Project
  • etc
http://cksdev.codeplex.com/
 

Blogroll

Jeff ANGAMA, is Office 365 / SharePoint Consultant. Started on MOSS2007 - More Infos Here -

RSE

Rechercher dans ce blog

Where Users are from ?