No me hago responsable si copiaste mal algún código que sale en las páginas de este sitio.
Ojalá sea de ayuda para más de alguno este sitio.
Se agradece si deja algún comentario.
Mostrando entradas con la etiqueta Developing. Mostrar todas las entradas
Mostrando entradas con la etiqueta Developing. Mostrar todas las entradas

jueves, 9 de diciembre de 2010

WSPBuilder (SharePoint WSP tool)

Project Description
A SharePoint Solution Package (WSP) creation tool for WSS 3.0 & MOSS 2007

No more manually creating the manifest.xml file.
No more manually specifying the DDF file.
No more using the makecab.exe application.

Before build:
http://www.keutmann.dk/sharepointblog/wspbuilder/wspdemo.jpg

Build:
http://www.keutmann.dk/sharepointblog/wspbuilder/wspbuilderconsole.jpg

After build:
http://www.keutmann.dk/sharepointblog/wspbuilder/buildresult.jpg

http://wspbuilder.codeplex.com/

jueves, 2 de diciembre de 2010

Hide Columns in SharePoint New, Edit and Disp Forms: Poweshell

Ref: http://howtosharepoint.blogspot.com/2010/11/hide-columns-in-sharepoint-new-edit-and.html

Hide Columns in SharePoint New, Edit and Disp Forms: Powershell


So here is the scenario, you have a issue tracking list and if you only want to introduce certain hidden columns on your New and Disp forms but not your Edit form as an example. You can have any combination for these requirements.
Since the issues are logged by the QA or end-user, we want to hide the Assigned To, Due Date, Priority and Impact from the new form. We want the user editing, typically the dev team lead, to assign these values.

There are several ways you can achieve this.. choose the best that fits your need... or comfortable with.

1. PowerShell
2. Programmatically
3. Custom Forms (SharePoint Designer)
4. ContentTypes
5. jQuery

Using Powershell

  • First we need to get the id of the fields to be hidden. A very important tool in your armor is a free tool called SharePoint Manager 2010.
  • Navigate to your Web-App > Site Collection > Site > List > Fields and get the ids of the fields you want to hide
  • Next we will use another important free tool PowerGUI and write the following powershell script
  • #$snapin = Get-PSSnapin | Where-Object {$_.Name -eq 'Microsoft.SharePoint.Powershell'}
    #if ($snapin -eq $null) {
    #Write-Host "Loading SharePoint Powershell Snapin"
    #Add-PSSnapin "Microsoft.SharePoint.Powershell"
    #}
    
    [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint")
    
    $WebUrl = "http://sp2010vmc002/hidecoldemo"
    Write-Host "Opening Web" $WebUrl
    $web = Get-SPWeb $WebUrl
    
    ####### Issue Tracker List ######
    $list = $web.Lists["IssueTracker1"];
    
    #Assigned To
    $FieldGuid = New-Object System.Guid("53101f38-dd2e-458c-b245-0c236cc13d1a");
    $Field = $list.Fields[$FieldGuid];
    
    $Field.ShowInNewForm = $false;
    $Field.ShowInDisplayForm = $true;
    $Field.ShowInEditForm = $true;
    
    $Field.Update();
    $list.Update();
    
    #Due Date
    $FieldGuid = New-Object System.Guid("cd21b4c2-6841-4f9e-a23a-738a65f99889");
    $Field = $list.Fields[$FieldGuid];
    
    $Field.ShowInNewForm = $false;
    $Field.ShowInDisplayForm = $true;
    $Field.ShowInEditForm = $true;
    
    $Field.Update();
    $list.Update();
    
    #Similarly for Impact and Propority..
    
    $Web.Dispose();  
    
  • The resultant new form will look like this




Ref:
http://blog.qumsieh.ca/2010/02/16/hide-columns-in-sharepoint-new-edit-and-disp-forms/

Validar si existe carpeta o biblioteca de documento

Ref: http://mundeep.wordpress.com/2009/02/24/checking-if-a-spfolder-exists/

Checking if a SPFolder Exists

Posted by mundeep on February 24, 2009
Ran into a colleague’s code that was incorrectly trying to check if a folder existed. It was something like:
1private bool CheckFolderExists(SPWeb parentWeb, string folderName) {
2    SPFolder folder = parentWeb.GetFolder(folderName);
3    if (folder == null) {
4        return false;
5    }
6    else {
7         return true;
8    }
9}
however this always returns an actual SPFolder object, and the correct way is to check the Exists property of the returned object ie:
1private bool CheckFolderExists(SPWeb parentWeb, string folderName) {
2    SPFolder folder = parentWeb.GetFolder(folderName);
3    return folder.Exists;
4}
NB: Yes, this post is almost identical to my earlier one about checking if an SPWeb object exists.