Posts

Showing posts with the label visual studio

Sharepoint 2010 - Assign Category to your Site Template (without VS)

Image
Set your Site Template in a Category is (maybe) simple with Visual Studio, but not the faster way. I tried with success by editing some xml in WSP package. Here step by step my solution. Save your site as template, "My_Site". Go in Solutions Gallery and download your My_Site.wsp package on desktop. Rename extension from .wsp to .cab. Use your tool to extract and create CAB archive, I used SimplyZip . Extract My_Site.cab and open to edit file Elements.xml in folder “ My_SiteWebTemplate ”. Add attribute DisplayCategory="My Site Templates" in tag “< WebTemplate> ” and save file. Use your tool to create new file My_Site.cab with all files from original cab and modified file. Note : with SimplyZip use Drag&Drop to set files and folders to add in cab. Change extension from .cab to .wsp and upload My_Site.wsp on Solutions Gallery. Now, try to create new Site: in the " Filter By:" section, you see  My Site Templates category...

Sharepoint 2010 - Ajax List Web Part

Image
I need web part that read from Site Collection, each Subsite, each Document Library, each Document, and return list of latest Documents of the entire Site Collection. Not very hard to develop, but it's very very bad in performance.. Web Part page take a long time to render. So the ajax idea. But how to? I found no way to expose ajax properties in tool panel of WP developed in VStudio. If you know how to.... write me, please! I checked out many posts, forums, articles about how to integrate Ajax Toolkit in Sharepoint. Then I do my way. I referenced Ajax Toolkit dll in my project. Download the right toolkit for Sharepoint here:  http://ajaxcontroltoolkit.codeplex.com/releases/view/33804 . To use the Ajax Control Toolkit in any web part control add the following lines to register the Ajax Control Toolkit namespace: <%@ Register Assembly="AjaxControlToolkit, Version=3.0.30930.28736,  Culture=neutral, PublicKeyToken=28f01b0e84b6d53e" Namespace="AjaxCon...

Sharepoint 2010 - Set Editor (Modified By) for Document in Doc Lib

I found many problems to update the field "Modified By" in a document loaded programmatically in a Document Library. After several attempts I found my solution. Use the "vti_modifiedby" from ListItem.File.Properties. Therefore, you must run these lines of code: spListItem.File.Properties["vti_modifiedby"] = SPContext.CurrentWeb.CurrentUser.LoginName; //Properties wants string spListItem.File.Update(); It Works! It does not works for  Document Set. I have not found the correct procedure. If anyone knows, write me!

Sharepoint 2010 - Email Event Receiver Issues

Image
The Email event receiver is not so simple to create and execute... I experienced some issues for the correct configuration. EmailReceived Method: wrong reference in Handle Email Receiver method created by VS When you create the email event receiver you see the method EmailReceived. In Visual Studio, see properties of event receiver and you see "handle email receiver" = false. If you set to true, VS creates method EmailReceiver with Microsoft.Sharepoint.SPEmailMessage insthead of Microsoft.Sharepoint.Utilities.SPEmailMessage. This cause error in build event receiver. I think is an issue/bug of Sharepoint 2010, but I did not found any documentation in MS. Solution : The event receiver work fine without set "handle" property to true. Leave this setting to false. Email Event Receiver: SPContext.Current is null Solution : use list.ParentWeb, from the list property of method EmailReceived. Email Event Receiver: if you have to process attachment of email If y...

Sharepoint 2007 - Deploy in produzione con Visual Studio 2008

Dopo aver partecipato a corsi di Sharepoint 2010 e visto quanto sia (relativamente ok...) semplice eseguire il Deploy di soluzioni dall'ambiente di test all'ambiente di produzione, mi sono scontrato con la realtà di Sharepoint 2007... Il deploy di una web part custom, implementata con Visual Studio 2008. Lo sviluppo è andato liscio, senza problemi. Il deploy in ambiente di test, ancora più semplice: tasto destro sul progetto, click su Deploy e via. Ora è giunto il momento del deploy in produzione.. Come fare? Diversi forum mi propongono soluzione a detta loro "semplici", con creazione di un progetto CAB per generare un package da copiare in produzione e poi deploy con stsadm. Non è così facile. Almeno, io ho incontrato difficoltà per due motivi: - o riconosce il file come CAB quindi vuole addpackage anziché addsolution - o (se rinominato in .wsp) non vuole addsolution - o mi dice che manca il manifest.xml (pur essendoci) Allora, ho seguito una mia strada. Da Visual S...