Mostrando entradas con la etiqueta AllowUnsafeUpdates. Mostrar todas las entradas
Mostrando entradas con la etiqueta AllowUnsafeUpdates. Mostrar todas las entradas

domingo, 16 de diciembre de 2012

Tips Info #3 Sharepoint 2013

1-Error page en Sharepoint 2013

Al activar la feature SharePoint Publishing feature, se agrega una página llamada PageNotFoundError.aspx y se encuentra disponible en la librería Pages

New-Picture-37

Para poder agregar la página, se debe agregar el content type “Error Page“. Este content type se basa en el content type Pages

 

New-Picture-38

New-Picture-40

2-Agregar una página de Sharepoint 2013 en un frame

Sharepoint 2013 agrega un header X-Frame options para prevenir de ataques clickjacking

Al agregar una página de Sharepoint 2013 en un frame, puede lanzarnos el siguiente mensaje: "This content cannot be displayed in a frame"

Cada respuesta HTTP envía una X-Frame-Options: header SAMEORIGIN, lo que indica que esta página no debe ser cargada en un IFRAME,  si la página que la hostea está en un dominio diferente de la página de SharePoint.

Por lo tanto, páginas externas llamadas desde Sharepoint no se verán afectadas, lo mismo que páginas de Sharepoint del mismo dominio que la actual. Pero páginas de Sharepoint 2013 llamadas desde otro dominio dentro de un frame nos lanzará el siguiente mensaje: "This content cannot be displayed in a frame"

Para solucionar este problema se puede agregar el siguiente web part: <WebPartPages:AllowFraming runat="server" />

Este webpart NO agregar el header de X-Frame-Options. Al crear páginas desde Visual Studio o cualquier herramienta de desarrollo de Microsoft, agregará de forma automática este webpart.

3-Modelo de Apps en Sharepoint 2013

IC599129

4-Error:  “The file reached the maximum download limit warnings. Check that the full text of the document can be meaningfully crawled”.

Abre el SharePoint Management Shell

$searchapp = Get-SPEnterpriseSearchServiceApplication
$searchapp.GetProperty("MaxDownloadSize") # el valor default es 64MB
$searchapp.SetProperty("MaxDownloadSize", 128) #128 es un valor adecuado para un límite de download
$searchapp.Update()

Reinciar el servicio OSearch14
Otra propiedad útil es MaxGrowFactor (por default 4), esto llevará a indexar 256MB (64 x 4), al igual que MaxDownloadSizexMaxGrowFactor.

5-Property Bag Values enSharePoint 2013 – Search

En la nueva versión de Sharepoint 2013, se puede agregar metadata a los sites/listas mediante la propiedad Bag y que esa metadata esté disponible en los resultados de búsqueda.

$web = Get-SPWeb http://websiteSharepoint
$web.AllowUnsafeUpdates = true
$web.AllProperties["PropiedadWeb"] = "valorWeb"
$web.IndexedPropertyKeys.Add("PropiedadWeb")
$web.Update()
$web.AllowUnsafeUpdates = false

Lo mismo se puede hacer para listas

$list = $web.Lists["Tareas"]
$folder = $list.RootFolder
$folder.Properties["PropiedadTareas"] = "valorTareas"
$list.AllowUnsafeUpdates = true
$folder.Update()
$list.IndexedRootFolderPropertyKeys.Add("PropiedadTareas")
$list.Update()
$list.AllowUnsafeUpdates = false

Una vez que se configuró las propiedades, se deberá hacer un full crawl.

Si se busca valorWeb o valorTareas, nos devolverá el site y lista respectivamente.

sábado, 23 de junio de 2012

Tips/Info #37 Sharepoint 2010

1-Mostrar el ONET.XML de un sitio de Sharepoint

Con agregar el siguiente texto /_vti_bin/owssvr.dll?Cmd=GetProjSchema a la url de un site, nos devuelve el archivo ONET.XML.

image

2-Soporte multidioma de un site mediante PowerShell

$spWebSite = Get-spWebSite http://sitio_url
$spWebSite.IsMultilingual = $true
$spWebSite.Update()
#Obtengo la configuracion regional actual usada por el server
$spRegionaSettings = New-Object Microsoft.SharePoint.SPRegionalSettings $spWebSite
$spRegionaSettings.InstalledLanguages
#agrego el lenguaje español (Argentina) debe estar previamente instaldo el language pack
$spWebSite.AddSupportedUICulture(11274)
$spWebSite.Update()
$spWebSite.Dispose()

3-No aparece la librería “Site Pages” y “Sites Assets”

Ir a Site Actions -> Site Settings –>Manage Site Features

Activar la feature Wiki Page Home Page

4-Error:  The security validation for this page is invalid. Click Back in your Web browser, refresh the page, and try your operation again.

Agrega a tu código la opción de AllowUnsafeUpdates a true.

Web.AllowUnsafeUpdates = true;
item["Title"]=”Sample”;
item.Update();

Otra manera es cambiar la opción Web Page Security Validation a Off

img1

5-xData.responseXML soporte multiplataforma en una consulta web services o spsservices al finalizar (complete)

Cambiar la siguiente sentencia:

$(xData.responseXML).find(“z\\:row”).each(function() {

por esto

$(xData.responseXML).find(“z\\:row, row”).each(function() {

z\\:row‘sólo trabaja de forma correcta en IE, y ‘row‘ trabajará en cada navegador.

miércoles, 6 de junio de 2012

Tips/info #28 Sharepoint 2010

1-Error: Sharepoint Service Error: A deployment or retraction is already under way for the solution “xxx.wsp” , and only one deployment or retraction at a time is supported

Para solucionar haga lo siguiente:

  • Abra una consola de powershell y vaya a la ubicación siguiente: C:\Program Files\Common Files\Microsoft Shared\web server extensions\14\BIN y escriba stsadm -o enumdeployments
  • Verificamos el id del job que está generando conflicto
  • Y ejecutamos lo siguiente: stsadm -o canceldeployment -id ” jobId”

    2-Error:“Error Updates are currently disallowed on GET requests.  To allow updates on a GET, set the ‘AllowUnsafeUpdates’ property on SPWeb. Troubleshoot issues with Microsoft SharePoint Foundation”

    $w = get-spwebapplication http://nombredelwebapplication
    $w.HttpThrottleSettings
    $w.Update
    ()
    3-Los botones de página de layouts y de texto de layouts está grisados o deshabilitados
    Ir a la master page del sitio y agregar en el body, lo siguiente:
    <body onload=”javascript:_spBodyOnLoadWrapper();”>
    4-Habilitar el modo debug de los archivos js de Sharepoint 2010
    Como saben, Sharepoint tiene dos versiones de cada archivo core de javascript de Sharepoint. Ej: sp.js, y el sp.debug.js
    Esos archivos pueden encontrarse en C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\_LAYOUTS
    Si se desea cargar los archivos debug para un web application, se debe ir a C:\inetpub\wwwroot\wss\VirtualDirectories y abrir la carpeta con el puerto deseado.
    Localizar web.config y editar de la siguiente manera:
    <compilation batch="false" debug="false">
    reemplazarlo con 
    <compilation batch="false" debug="true">
    y hacer un iisreset.
    5-Obtener las content database por web application con powershell
    Get-SPWebApplication | %{Write-Output "`n- $($_.url)"; foreach($cd in $_.contentdatabases){Write-Output $cd.name}} >> C:\Temp\contentdatabases.txt
    6-ListItem.Update Powershell Exception (Cannot take 0 arguments)



    Posiblemente la excepción sea por problemas de permisos del usuario que ejecuta el script.


    7-No aparece la opción “Manage content and structure”


    Habilitar las features 'SharePoint Server Publishing Infrastructure' a nivel de Site Collection, y después activar la feature 'SharePoint Server Publishing'


    8-Agregando un adjunto con SPList a un item


  • private void AgregarAdjunto(int ID_item)
    {
        try
        {
            SPList lista = SPContext.Current.Web.Lists["nombre Lista"];


            SPListItem miItem = lista.GetItemById(ID_item);


            if (fileUpload.PostedFile != null && fileUpload.HasFile)
            {


                Stream fStream = fileUpload.PostedFile.InputStream;


                byte[] contents = new byte[fStream.Length];


                fStream.Read(contents, 0, (int)fStream.Length);


                fStream.Close();


                fStream.Dispose();


                SPAttachmentCollection attachments = miItem.Attachments;


                string fileName = Path.GetFileName(fileUpload.PostedFile.FileName);


                attachments.Add(fileName, contents);


                miItem.Update();


            }


        }
        catch (Exception ex)
        {    }
    }


    9-Cargar un archivo css mediante el control CssRegistration


    <SharePoint:CssRegistration ID="CssRegistration1" Name="/Style Library/estilo.css"
        runat="server" After="corev4.css" />

    10-Acciones de comando en los custom actions

    {ItemId} – ID (GUID) taken from the list view.
    {ItemUrl} – Web-relative URL of the list item (Url).
    {RecurrenceId} – ID of a recurrent item (RecurrenceID).
    {SiteUrl} – The fully qualified URL to the site (Url).
    {ListId} – ID (GUID) of the list (ID).
    {ListUrlDir} – Server-relative URL of the site plus the list's folder.
    {Source} – Fully qualified request URL.
    {SelectedListId} – ID (GUID) of the list that is currently selected from a list view.
    {SelectedItemId} – ID of the item that is currently selected from the list view.
    ~site    SPContext.Current.Web.ServerRelativeUrl
    ~sitecollection    SPContext.Current.Site.ServerRelativeUrl


    http://msdn.microsoft.com/en-us/library/ff458385.aspx