Posts

Showing posts with the label list

SharePoint 2007/10 - How to Filter List Items by Workflow (Approval) Status

Image
In order to filter documents or items in a list by status of the workflow, we can create a new view and set the filter using the column [Workflow Status]. But if we try to insert as a filter "Approved" or "Rejected", we do not get results. The Workflow Status is stored as a numerical value! The values ​​are as follows: Not Started - 0 Failed on Start - 1 In Progress - 2 Error Occurred - 3 Canceled - 4 (manually) Completed - 5 Failed on Start (retrying) - 6 Error Occurred (retrying) - 7 Canceled - 15 (from workflow) Approved - 16 Rejected - 17 The correct setting of the filter will then be like the following image: Pay attention to the values ​​for Canceled! If the cancellation is done automatically by the Workflow, use the value 15, but if the Workflow is stopped manually by the administrator (eg because of error), then you need to use a value of 4!

SharePoint 2010 - List View Lookup Threshold

Image
By modifying a view to show all the columns of Worfklow associated Status (many), I get this message: "This view can not be displayed Because The number of lookup and workflow status columns it contains Exceeds the threshold (8) enforced by the administrator." Do not worry, you can change this threshold, but it is not recommended for performance problems. Read this post to learn more (in English): The SharePoint 2010 "List View Lookup Threshold" and Why We Do not Change It

SharePoint 2010 - List View Lookup Threshold

Image
Modificando una vista, in modo da visualizzare tutte le colonne di stato dei Worfklow associati (molti, in effetti), al salvataggio ricevo questo messaggio: "This view cannot be displayed because the number of lookup and workflow status columns it contains exceeds the threshold (8) enforced by the administrator." Niente paura, si può modificare questa soglia, ma non è consigliato farlo per problemi di performance. Leggi questo post per saperne di più (in inglese): The SharePoint 2010 “List View Lookup Threshold” and Why We Don’t Change It

SharePoint 2010 - Impostare ListId di un FormField da codebehind

Con Visual Studio, si è rivelato molto comodo poter utilizzare i FormField per form di inserimento o modifica degli item di una lista. Purtroppo, sembrava inutile ogni nostro tentativo di impostare via codice il parametro ListId, così per un paio di volte abbiamo dovuto fare l'inserimento del GUID della lista manualmente.... Con tutti i problemi del caso, per i deploy in altre macchine, ad esempio. Poi, finalmente, il post giusto ci dà l'imbeccata per il metodo che segue e che è stato risolutivo! Utilizzare il FormField come segue, inserendo una funzione OnInit e non impostando ListId. <SharePoint:FormField ID="FormField1" OnInit="setFormFieldListId_OnInit" ControlMode="Edit" FieldName="ColumnName" runat="server" /> A codice, definire la funzione indicata qui sotto, in cui viene impostato il ListId alla creazione del controllo: protected void setFormFieldListId_OnInit(object sender, EventArgs e) ...

Sharepoint 2010 - Show/Hide columns with Conditional Formatting

Image
In a previous post I describe how show/hide columns of a list with UI language, using javascript . Now, I show how do the same using Conditional Formatting feature of Sharepoint Designer 2010. I have same list with columns for language, DescriptionIT, DescriptionEN. Open Sharepoint Designer 2010, and edit page with list view. Select List and add Parameter for language taken from Cookies: Then, select tag <TH> for List Column DescriptionIT, using selector at the bottom of page: Now, in the Condition Formatting panel, click on Create and Apply Formatting: In the filter clause, click on Advanced and write code as below: Then, click OK, and Set Style, in Layout section, set Display:none: Click OK and OK again. Repeat steps selecting <TD> tag for values of column DescriptionIT. Do it again for DescriptionEN column, with condition "($cookieLanguage!='1033')". Save page and view in browser, checking colum...

Sharepoint 2010 - Associate Workflow to List with Power Shell

I create a new Workflow Template (globally reusable) in root site and I associate it to a List in a Site Template. But I need to update each sub site (created from my Site Template) with the new Workflow. I use PowerShell, to cycle each subsite and associate WF to content type list. This is command I used: [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint") $site=Get-SPSite "http://sharepoint_root_site" foreach($web in $site.AllWebs){    $list=$web.Lists["MyList"]    $taskList=$web.Lists["Workflow Tasks"]    $historyList=$web.Lists["Workflow History"]    $ct=$list.ContentTypes["MyContenType"]    $culture=New-Object System.Globalization.CultureInfo("en-US")    $wfTemplate=$web.WorkflowTemplates.GetTemplateByName("wfTemplate", $culture)    $associationWF=[Microsoft.SharePoint.Workflow.SPWorkflowAssociation]::CreateListContentTypeAssociation($wfTemplate, "MyWFInSubSi...

Sharepoint 2010 - Filter List/Library Web Part with XSLT and Content Editor WP

Image
I created a simple Filter Web Part with a Content Editor WP and simple XLST to filter List/Library with the LIKE feature. It works for lists and libraries (in libraries not for Name field). Create a page with Library Web Part to filter. Then add a Content Editor Web Part end edit HTML Source. In HMTL, add an input textbox and two buttons, for reset filter and for submit filter. Add some script as shown below: <script type="text/javascript"> //this script get query string from URL function querySt(ji){   hu = window.location.search.substring(1);   gy = hu.split("&");   for (i=0;i<gy.length;i++){     ft = gy[i].split("=");     if (ft[0] == ji){       return ft[1];     }   } } //this script set value read from query string in input field function setValues(){    if(querySt('qtitle') != null && querySt('qtitle') != "")    {      document.getEleme...

Sharepoint 2010 - Delete this List link missing

If menu item "Delete this List" in list settings is missing or, in Sharepoint Designer 2010, you receive error in deleting list/library, may be problems is for AllowDeletion property of the List/Library. Once you declare an item as a record in a list, the corresponding lists SPList.AllowDeletion property is set to False. This is why you no longer see the "Delete this List" link in the list settings and is intended to protect lists with items declared as records. You can use PowerShell to delete the list (using the SharePoint 2010 Management Shell): $assignment = Start-SPAssignment $web = Get-SPWeb -Identity "http://yoursite" -AssignmentCollection $assignment $list = $web.lists["Your List Title"] $list.AllowDeletion = $true $list.Update() #after this is entered, the "Delete this List" link will reappear in the UI for the List Settings $list.Delete() #this will delete the list Stop-SPAssignment $assignment Yes, it's wor...

Sharepoint 2010 - Aggiungere bottone al Ribbon con Sharepoint Designer 2010

Image
Vediamo come aggiungere un bottone personalizzato al Ribbon di una lista o document library, utilizzando solo lo Sharepoint Designer 2010. Apriamo il sito con SPD2010, nelle liste, selezionamo la lista che vogliamo utilizzare. A fondo pagina, vediamo il blocco Azioni Personalizzate. Non clicchiamo su Nuovo, ma facciamo un clic con il mouse all'interno del blocco e dal menu contestuale, scegliamo Azione Personalizzata. Vediamo un menu a discesa con diverse opzioni: La traduzione italiana pessima rende oscura l'interpretazione delle voci... Provo a spiegarle. Menu voci elenco : il bottone è visualizzato nel menu a tendina sull'item Visualizza barra multifunzione modulo : il bottone è visualizzato nella scheda "View properties" Modifica barra multifunzione modulo : il bottone è visualizzato nella scheda "Edit properties" Nuova barra multifunzione modulo : il bottone è visualizzato nella scheda "New item" Visualizza barra multi...