Mostrando entradas con la etiqueta Health Analyzer. Mostrar todas las entradas
Mostrando entradas con la etiqueta Health Analyzer. Mostrar todas las entradas

miércoles, 27 de junio de 2012

Tips/Info #39 Sharepoint

1-Error al tratar de acceder a la base de datos de search

Exception: System.Runtime.InteropServices.COMException (0xC0041236): Could not access the Search administration database. A generic error occurred while trying to access the database to obtain the schema version info.  

Ir a Start Menu -> SQL Server 2008 R2 -> Configuration Tools -> SQL Server Configuration Manager

verificar que la opción “Shared Memory” esté habilitada

SQLServerClient

Recuerde ejecutar SharePoint 2010 Products Configuration Wizard

También borre el siguiente registro:

“HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Shared Tools\Web Server Extensions\14.0\WSS\Services\Microsoft.SharePoint.Search.Administration.SPSearchService”

2-Cargar funciones de javascript en el evento onload en Sharepoint

Sharepoint tiene el arreglo “_spBodyOnLoadFunctionNames”. Cuando el body es cargadp, el handler del evento onload ejecuta cada función que esté contenida en este arreglo. Ej:

<script language=”javascript”>
_spBodyOnLoadFunctionNames.push(“NombreFuncion”);
function NombreFuncion()
{
// Custom Javascript
}
</script>

3-Al restaurar una base de datos, Sharepoint nos dice que debemos hacer un upgrade

Get-SPContentDatabase |    ? { $_.NeedsUpgrade -eq $true } |    Upgrade-SPContentDatabase -Confirm:$false -Verbose:$true |    ft Name, Id, CanUpgrade, NeedsUpgrade
4-Ejecutar todos los jobs del Health Analyser

$jobs = Get-SPTimerJob | Where-Object {$_.Title -like "Health Analysis Job*"}
foreach ($job in $jobs)
{
  $job.RunNow()
}


5-Error “The application attempted to perform an operation not allowed by the policy.  To grant this application the required permission please contact your system administrator or change the application’s trust level in the configuration file.”


Anda al web.config del web application donde activas la feature C:\inetpub\wwwroot\wss\VirtualDirectories\[Web application directory]. Busca la siguiente línea:


<trust level="WSS_Minimal" originUrl="" />.


y reemaplaza WSS_Minimal con Full o WSS_Medium.

viernes, 8 de junio de 2012

Tips/info #29 Sharepoint 2010

1-Algunas cosas del media web part de Sharepoint 2010

Formatos de archivos que soporta: http://msdn.microsoft.com/en-us/library/cc189080(VS.95).aspx

No soporta flash.

Permite streaming de otros sitios

Es una feature de Publishing

Más info: http://blogs.msdn.com/b/sanjaynarang/archive/2010/05/20/media-web-part-in-sharepoint-2010-faq.aspx

2-Ejecutar todos los jobs del Health Analyzer mediante PowerShell

Get-SPTimerJob | Where {$_.Name -like "*Health*" -and $_.Name -like "*-all-*"} | Start-SPTimerJob

3-Debugging de timer de jobs

Hay veces que el debugging de atachar el proceso de w3wp no funciona, para ello se puede usar:

System.Diagnostics.Debugger.Launch();

Esta instrucción hará que salte el típico cuadro de diálogo que nos permite seleccionar el depurador que queremos adjunta a nuestro servicio. Evidentemente la podemos usar en aplicaciones que no sean servicios para tener la oportunidad de ajuntar un depurador cuando se ejecute determinado código

image_a7457bd8-76d6-49f4-b605-de1b14a3aaef

3-Export web con la seguridad y las últimas 3 versiones de los archivos

Export-SPWeb -Identity http://servidor/sitio -Path "C:\Backup.bak" –IncludeUserSecurity -IncludeVersions 3

IncludeUserSecurity: Conserva la configuración de seguridad del usuario.

IncludeVersions: Indica qué tipo de historial de versiones de archivos y elementos de lista debe incluirse en la exportación. Si el parámetro IncludeVersions no está presente, el cmdlet Export-SPWeb usará el valor 1 como predeterminado.

4-Cambiar los iconos de los tipos de archivos

Estos pasos se deben hacer en cada WFE, ir a :

C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\IMAGES\

    Subir el icono deseado.

    Después ir a

    C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\XML\

    y editar el archivo docIcon.xml, encontrar el elemento <ByExtension>, y cambiarle el atributo de la imagen con el nombre que subimos en el paso 1.

    <Mapping Key="pdf" Value="pdf-small.png"/>

    5-Borrar site huérfanos

    Ejecutar enumweb sobre todas las base de datos para checkear sites huérfanos.
    stsadm –o enumallwebs –databasename "databasename" –databaseserver

    stsadm -o deletesite -siteid "GUID" -databaseserver "SQLServerame" -databasename "databasename" –force

    6-Borrar web parts huérfanos

    Abrir la página en modo mantenimiento (?content=1) y borrar el web part huérfano (no usar Remove)

    The error "Missing server side dependencies" came up with an explanation saying "WebPart class [GUID] is referenced [x] times in the database [ContentDB], but is not installed on the current farm."

    Usar la siguiente consulta SQL para saber en que lugar está el web part huérfano.

    SELECT Id, SiteId, DirName, LeafName, WebId, ListId, tp_ZoneID, tp_DisplayName

    from AllDocs

    inner join AllWebParts on AllDocs.Id = AllWebParts.tp_PageUrlID

    where AllWebParts.tp_WebPartTypeID = 'GUID’;

    7-Agregar palabras custom al spell check (corrector ortográfico) de Sharepoint 2010

    Crear una document library a nivel del root site, es decir a nivel de site collection llamada ‘Spelling’.

    Crear un archivo .txt con términos custom que se agregaran al diccionarion– un término por línea y guardalo con el nombre “Custom Dictionary.txt”.

    Y subí el txt a la librería “Spelling”.

    8-Relink los forms de infopath después de migrar

  • Abrir la libreria de forms
  • Click “Modify Columns and Settings”
  • En la sección General Settings, click Relink forms to this form library.
  • En la vista presentada, seleccionar todos los forms que se quieren relinkear.
  • Click el botón Relink

  • También se puede usar el siguiente comando de powershell;


     Update-SPInfoPathAdminFileURL -find <OldUURLtoReplace> -replace <NewURL>


    9-Jquery y SPServices


    Si se usa una versión más grande de SPServices que 0.7.1a usarlo de la siguiente manera:


    jQuery(xData.responseXML).SPFilterNode(“z:row”)


    Sino usar:


    jQuery(xData.responseXML).find(“z\\:row’”)


    10-Desactivar una feature en todos los sitios de una site collection

    $url = "http://sharepoint_site"
    $sitio = Get-SPsitio $url
    foreach($web in $sitio.AllWebs)
    {
    $url = $web.Url
    if($url -ne $url){
    foreach($feature in Get-SPFeature -Web $url)
    {
    $featureName = $feature.DisplayName
    if($featureName -eq "NOMBRE_FEATURE")
    {
    "Desactivo al feature en la web"
    Disable-SPFeature -Identity NOMBRE_FEATURE -Url $url -Confirm:$false
    break;
    }
    }
    }
    }



    sábado, 17 de marzo de 2012

    Tips #8–Sharepoint 2010

    1-El menú Site actions no aparece!!!

    Agregar la url del site como trusted site

    Ejecutar el IE como administrador.

    2-Script para mostrat todos los administradores de site collection

       1:  $sitioRoot = New-Object Microsoft.SharePoint.SPSite($sitioUrl)
       2:  $spWebApp = $sitioRoot.WebApplication
       3:   
       4:  foreach($site in $spWebApp.Sites)
       5:  {
       6:      foreach($siteAdmin in $site.RootWeb.SiteAdministrators)
       7:      {
       8:          Write-Host "$($siteAdmin.ParentWeb.Url) - $($siteAdmin.DisplayName)"
       9:      }
      10:      $site.Dispose()
      11:  }
      12:  $sitioRoot.Dispose()



    3-Recorrer todos los site collections y subsitios



       1:  function RecorrerSite() {
       2:      param([Microsoft.SharePoint.SPWeb]$SiteIdentity)
       3:   
       4:      Write-Output "Sitio: $($SiteIdentity.Url)"
       5:      
       6:      if($SiteIdentity.Webs.Count -gt 0)
       7:      {
       8:          foreach($subSitio in $SiteIdentity.Webs)
       9:          {
      10:              RecorrerSite -SiteIdentity $subSitio
      11:          }
      12:      }
      13:  }
      14:   
      15:  $servicioWebApplication = (Get-SPFarm).services |
      16:   ? {$_.typename -eq "Microsoft SharePoint Foundation Web Application"}
      17:   
      18:  foreach($webApp in $servicioWebApplication.WebApplications)
      19:  {
      20:      Write-Output "Web Application: $($webApp.name)"
      21:      foreach($siteColl in $webApp.Sites)
      22:      {
      23:          Write-Output "Colleccion de sitio: $($siteColl.Url)"
      24:          RecorrerSite -SiteIdentity $($siteColl.RootWeb)
      25:      }
      26:  } 



    4-Clase ContentIterator para procesar una lista de gran tamaño



    SharePoint Server proporciona un API,ContentIterator, para ayudar con el acceso a más de 5.000 elementos en una lista larga y no chocar con el throttling de la lista (SPQueryThrottleException). ContentIterator permite segmentar la consulta para el procesamiento de manera única. Considere el uso de esta capacidad si es necesario para procesar un gran número de elementos que pueden exceder el throttling de una lista.


     


       1:  static int exceptions = 0;
       2:  static int items = 0;
       3:   
       4:  protected void OnTestContentIterator(object sender, EventArgs args)
       5:  {
       6:      items = 0;
       7:      exceptions = 0;
       8:      string query1 = @"<View>
       9:          <Query>
      10:              <Where>
      11:                  <And>
      12:                      <BeginsWith>
      13:                          <FieldRef Name='SKU' />
      14:                          <Value Type='Text'>S</Value>
      15:                      </BeginsWith>
      16:                  </And>
      17:              </Where>
      18:          </Query>
      19:      </View>";
      20:   
      21:      ContentIterator iterator = new ContentIterator();
      22:      SPQuery listQuery = new SPQuery();
      23:      listQuery.Query = query1;
      24:      SPList list = SPContext.Current.Web.Lists["Parts"];
      25:      iterator.ProcessListItems(list,
      26:          listQuery,
      27:          ProcessItem,
      28:          ProcessError
      29:      );
      30:  }
      31:   
      32:  public    bool ProcessError(SPListItem item, Exception e) 
      33:  { 
      34:      // process the error
      35:      exceptions++; 
      36:      return true; 
      37:  }
      38:  public void ProcessItem(SPListItem item)
      39:  {
      40:      items++;
      41:      //process the item.
      42:  }



    5-Constantes de los estados de workflows




    • Status: Value
    • Not Started: 0
    • Failed on Start: 1
    • In Progress: 2
    • Error Occurred: 3
    • Canceled: 4
    • Completed: 5
    • Failed on Start(Retrying): 6
    • Error Occurred (Retrying): 7
    • Canceled: 15
    • Approved: 16
    • Rejected: 17

    6-The SharePoint Health Analyzer detected a condition requiring your attention. Drivers are at risk of running out of free space



    Para evitar este error, deberás tener 5 veces más de RAM que espacio libre en el server.



    7-Falta “Destination Folder” cuando se sube un documento



    Se debe activar la feature Metadata Navigation and Filtering


    8-Durante el backup de un site se pone el site cómo sólo lectura, en el caso que haya una interrupción (ej:reiniciar el server), se dejará como sólo lectura. Para ello será necesario ejecutar lo siguiente:



    Set-SPSite -Identity http://mysite -LockState "Unlock"


    9-Cambiar la opción del indicador “New” en los documentos recientemente subidos


    El default para que aparezca el valor “Nuevo” es de dos días.
    Verificar la configuración actual:


    stsadm.exe -o getproperty -pn days-to-show-new-icon -url http://misitio


    Cambiar a 4 días


    stsadm.exe -o setproperty -pn days-to-show-new-icon -pv 4 -url http://misitio
    Si lo seteo a 0 (cero), directamente no aparece.


    10-Enviar un mail con powershell



       1:   function enviarMail{
       2:   
       3:       Write-Host "Enviando Email"
       4:   
       5:       #nombre del servidor SMTP
       6:       $smtpServer = "smtp.xxxx.com"
       7:   
       8:       #Creando un objeto mail
       9:       $msg = new-object Net.Mail.MailMessage
      10:   
      11:       #Creando un objeto SMTP server
      12:       $smtp = new-object Net.Mail.SmtpClient($smtpServer)
      13:   
      14:       #Email formato
      15:       $msg.From = "fromID@mail.com"
      16:       $msg.ReplyTo = "replyto@mail.com"
      17:       $msg.To.Add("toID@mail.com")
      18:       $msg.subject = "Mi asunto"
      19:       $msg.body = "Es es el cuerpo del mail."
      20:   
      21:       #Enviando el mail
      22:       $smtp.Send($msg)
      23:    
      24:  }
      25:   
      26:  #Llamo a la funcion
      27:  enviarMail