Posts

Showing posts with the label development

Sharepoint 2010 - About Uselessness of Content Query Web Part?

Image
.. Why Content Query Web Part...?? I did not found any reason to use Content Query Web Part.. Or maybe, I am no really skilled to find a way to use it with a real reduction of configuring costs. In the same time I build custom XLS for CCQWP, I can develop a Custom web part with Visual Studio... No, I think I develop custom wp in less time... Sure, with minor performance, but it works anywhere and it has simple governance, for me... And you? You found way to use "simple" CQPW? Maybe, only a demoralization time..

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 - Migrate List-based Workflows between Sites and Site Collections

Thank you Gavinmckay, you saved me! From his blog:  http://gavinmckay.wordpress.com/2011/08/29/howto-move-or-migrate-sharepoint-2010-list-based-workflows-between-sites-and-site-collections/ I’ve experienced this issue a lot when trying to migrate workflows between test SharePoint 2010 farms and production farms, in particular with workflows attached to lists. When moving a workflow to another site collection or server farm, the association to the list is broken and the workflow cannot be attached to the list. You also cannot use SharePoint designer to fix this via the standard methods as the unattached workflow cannot be reattached to the list. List-based workflows are tied to three different lists – the “main” source list where the data is held (such as a Forms library or custom list), a task list, and a workflow history list. The latter in particular is tricky, because it is a hidden list and cannot be viewed via the normal interface. The fix for this is to modify the sou...

Sharepoint 2010 - Enable/Disable Ribbon Button with EcmaScript

I show you a detailed example of how to enable and disable a ribbon button according to the current user’s group. The example uses “EnabledScript” attribute of the CommandUIHandler of the ribbon button. Then the EnabledScript is built with EcmaScript to find groups and user info. Lets Start with creating a Ribbon button first. 1. Create a empty project. 2. Deploy it as a Farm solution. 3. Right click on the feature and click “Add feature”. 4. Right click on the project and add a new “Empty Element” item. 5. Next add the below code to add a custom Ribbon button to your document library. <Elements xmlns=”http://schemas.microsoft.com/sharepoint/” > <CustomAction Id=”ButtonForGroupUsersOnly” Location=”CommandUI.Ribbon” RegistrationId=”101″ RegistrationType=”List” Title=”Owners Group Button”> <CommandUIExtension> <CommandUIDefinitions> <CommandUIDefinition Location=”Ribbon.Library.ViewFormat.Controls._children”> <Button Id=”Ribbon.L...

Sharepoint 2010 - Modify Documents Properties with ECMA Script

Finally I found the way to modify document properties with ECMA Script! It's not an hard work for Document Libraries with no mandatory check out. Here the script: function updateDocument(action, docLibId, docId, fieldName, fieldValue) {     var context = new SP.ClientContext.get_current();       var web = context.get_web();       var docLibGuid = new SP.Guid(docLibId);       var docLib = web.get_lists().getById(docLibGuid);       var doc = docLib.getItemById(docId);       doc.set_item(fieldName, fieldValue);         doc.update();       context.executeQueryAsync(Function.createDelegate(this, this.successUpdateDocument), Function.createDelegate(this, this.failed));  } function successUpdateDocument(sender, args) {       //reload page if success       location.reload(true); } But when we set check out mandatory, we ...

SharePoint 2010 WebPart Properties not saving

Image
I lost many time to find the way to save properties of a custom web part in Sharepoint 2010. All my classes, methods, properties are defined correctly, but when I deploy web part and I try to save props, values were not saved and web part load with his default values. Then I search for solution and I found that it is due to disposing the current web (SPContext.Current.Web). I understood that I don't have to dispose SPContext.Current.Web object in my code and neither use using(SPWeb web = SPContext.Current.Web). The solution is to use directly SPWeb web = (new SPSite(SPContext.Current.Site.ID)).openweb(SPContext.Current.Web.ID); to initiate a new web object and then dispose it after using. The Save button finally saved properties values!

Google+: Le mie Attività - Gadget per il tuo sito

Come promesso. Un po' di smanettamento e via con una mia prima applicazione di esempio delle API per Google+. Una cosa interessante della chiamata per le attività di un utente è la possibilità di definire nell'URL la funzione javascript che deve essere chiamata al rientro della risposta JSON. Il nostro json, infatti, non è così immediatamente utilizzabile (e di certo esistono molti più esperti di me, nel settore, ma io l'ho scoperto pian pianino) e ha bisogno di un po' di aiuto, sopratutto quando si tratta di chiamate cross-domain. Bene. Jquery ci aiuta, sì e no: ho usato le librerie JSONP, che ho linkato direttamente da  http://jquery-jsonp.googlecode.com/files/jquery.jsonp-2.1.4.min.js . La chiamata, così, è composta in questo modo: $(document).ready( function () {    $.jsonp({ url: "https://www.googleapis.com/plus/v1/people/100661704413873131754/activities/public?callback=readJSON&key=YOUR_APIKEY" }); }); Nell'URL notiamo il param...

Android SDK - Install su Windows 7 32bit

Image
Oggi ho provato ad installare l'Android SDK sul mio pc Windows7 a 32bit. Il primo messaggio dice "Java SE development Kit (JDK) not found": giusto, non c'è. Seguo le indicazioni, scarico e installo JDK. Riprovo Android SDK e ancora "Java SE development Kit (JDK) not found"... Ho trovato su un forum che il problema si presenta sia con Windows7 32 bit che con Windows XP SP3. La soluzione: Nella schermata del messaggio "JDK not found", clicca su BACK e poi ancora NEXT ed ecco che si può continuare.. Mah...