jump to navigation

Send Mail Power Shell March 6, 2018

Posted by juanpablo1manrique in SharePoint.
Tags: ,
add a comment

SharePoint 2013 Management Shell – SharePoint 2010 Management Shell
$sd = new-object System.collections.specialized.stringdictionary
$sd.add(“to”,”uncorreodest@undominio.co”)
$sd.add(“from”,”unorigen@undominioorg.com”)
$sd.add(“Subject”,”The clue is in the name!”)
$web = get-spweb “http://misharepoint/”
$body = “This is our body<br/> We can use <strong>HTML</strong> codes in it.”
[Microsoft.SharePoint.Utilities.SPUtility]::SendEmail($web,$sd,$body)

 

Windows Power Shell 1
Send-MailMessage -To “uncorreodest@undominio.co” -From “unorigen@undominioorg.com” -Subject “Test mail” -Body “Body aaaa” -SmtpServer “smtp.unorigen.com”

Windows Power Shell 2

$message=new-object Net.Mail.MailMessage;
$message.From=”unorigen@undominioorg.com”;
$message.To.Add(“uncorreodest@undominio.co”);
$message.Subject=”subjecttexthere…”;
$message.Body=”bodytexthere…”;
$smtp=new-object Net.Mail.SmtpClient(“smtp.unorigen.com”,”25″);
$smtp.EnableSSL = $false;
$smtp.Credentials = New-Object System.Net.NetworkCredential(“undominio\unusuario”, “*************”);
$smtp.send($message);

Open Advanced Shared Item . Time Out September 20, 2017

Posted by juanpablo1manrique in SharePoint, SharePoint2013.
Tags:
add a comment

Hello,

In this days I have a problem when I tried to enter at page of advanced shared.

  • In the item click in (…)
  • An other time (…)
  • Share With
  • but Waiting … and waiting … till time out,

in SharePoint Logs you find

Slow Query Duration: 104507.8692

If you have a farm with a upper version of 15.0.4571.1502 Apr 2014

You can run

$db = Get-SPContentDatabase -Identity WSS_CONTENT_etc
$db.repair($true)

You maybe should make backup after,

Regards

SPSecurityTrimmedControl fails in other URL August 30, 2017

Posted by juanpablo1manrique in SharePoint2013.
Tags:
add a comment

Amigos les cuento la situación,

Justamente en estos días agregue una URL nueva a un sitio, el sitio navegaba bien pero al intentar dar click en el link de iniciar sesión direccionaba a la URL antigua.

Al revisar,

Internal URL Zone Public URL for Zone
http://urlanterior Default http://urlanterior
https://urlanteriornueva Default https://urlanteriornueva

En SharePoint 2010 al intentar agregar dos URLs en la misma zona arrojaba un error, pero en el caso de SharePoint 2013 el tema es permitido, navega y todo, pero se presenta este error con el control de inicio de sesión. Para solucionarlo se actualizo como en SHP 2010.

 

Internal URL Zone Public URL for Zone
http://urlanterior Default http://urlanterior
https://urlanteriornueva Internet https://urlanteriornueva

Muchas Saludes,

WebHttpBinding “HttpContext.Current” null WCF SharePoint October 20, 2016

Posted by juanpablo1manrique in SharePoint.
Tags:
1 comment so far

Desafortunadamente WCF no soporta estado y en SharePoint todos los trucos posibles no funcionaron,

[ServiceContract(Namespace = “”)]
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Required)]
[ServiceBehavior(InstanceContextMode = InstanceContextMode.PerSession)]
public class MiService : ServiceBase

Tambien intente.

string cookieHeader = WebOperationContext.Current.IncomingRequest.Headers[HttpRequestHeader.Cookie];
// Here you can see the OutgoingResponse Header has set the cookies.
Match match = Regex.Match(cookieHeader, @”^SessionID=(?.*)$”);
if (match.Success)
{

//YEAH!!! I get it; but nop, never passed this way,
throw new Exception(match.Groups[“SessionID”].Value);
}
else
{
WebOperationContext.Current.OutgoingResponse.Headers[HttpResponseHeader.SetCookie] = cookieHeader + “;” + string.Format(“SessionID={0}”, “MIDATOAGUARDAR”);
}

Y tampoco,

Si saben algo me cuentan

 

SOLUCION

Una solucion que encontre para este caso es la siguiente,

ObtenerObjeto de negocio -> enviarlo como entrada en todos los métodos siguientes.

Finalmente en la nueva programación FronEnd ya no utilizamos el aburrido ViewState, así que manejamos el estado nosotros mismos,

System.UnauthorizedAccessException Anonymous JSOM October 12, 2016

Posted by juanpablo1manrique in SharePoint2013.
Tags:
add a comment

Para solucionar esto

1.Paso

Central Administration ->
Application Management ->
Manage web applications ->
Select : Authentication Providers ->
Default ->

Uncheck Require Use Remote Interfaces permission:

2.Paso

$web = Get-SPWebApplication -Identity http://myserver:myport
$web.ClientCallableSettings.AnonymousRestrictedTypes.Remove([Microsoft.SharePoint.SPList],”GetItems”)
$web.Update()

SPContext.Current == null August 30, 2016

Posted by juanpablo1manrique in SharePoint.
Tags:
add a comment

Create fake SPContext.Current

using (SPSite oSPsite = new SPSite(webUrl))
{
using (SPWeb oSPWeb = oSPsite.OpenWeb())
{

HttpContext newContext = null;
if (HttpContext.Current == null)
{
var request = new HttpRequest(“”, oSPWeb.Url, “”);
newContext = new HttpContext(request, new HttpResponse(TextWriter.Null));
HttpContext.Current = newContext;
}
HttpContext.Current.Items[“HttpHandlerSPWeb”] = oSPWeb;
HttpContext.Current.Items[“HttpHandlerSPSite”] = oSPsite;

Acceso anónimo listas SharePoint July 22, 2016

Posted by juanpablo1manrique in SharePoint.
Tags:
add a comment

Has tenido problemas, le das acceso anónimo y pide autenticación

get-spfeature -site http://sitecollURL
$lockdown = get-spfeature viewformpageslockdown
disable-spfeature $lockdown -url http://sitecollURL
Dar el permiso y despues volver a activar

$lockdown = get-spfeature viewformpageslockdown
enable-spfeature $lockdown -url http://sitecollURL

 

Purge WSS_Logging July 11, 2016

Posted by juanpablo1manrique in Best Practices, SharePoint2013, SQL SERVER, SQL SERVER 2008.
Tags: ,
add a comment

Hola,

Liberar espacio de WSS_Logging
Set-SPUsageDefinition -Identity “Analytics Usage” -DaysRetained 1 -Enable
Set-SPUsageDefinition -Identity “App Statistics.” -DaysRetained 1 -Enable
Set-SPUsageDefinition -Identity “Bandwidth Monitoring” -DaysRetained 1 -Enable
Set-SPUsageDefinition -Identity “Content Export Usage” -DaysRetained 1 -Enable
Set-SPUsageDefinition -Identity “Content Import Usage” -DaysRetained 1 -Enable
Set-SPUsageDefinition -Identity “Feature Use” -DaysRetained 1 -Enable
Set-SPUsageDefinition -Identity “File IO” -DaysRetained 1 -Enable
Set-SPUsageDefinition -Identity “Page Requests” -DaysRetained 1 -Enable
Set-SPUsageDefinition -Identity “REST and Client API Action Usage” -DaysRetained 1 -Enable
Set-SPUsageDefinition -Identity “REST and Client API Request Usage” -DaysRetained 1 -Enable
Set-SPUsageDefinition -Identity “Sandbox Request Resource Measures” -DaysRetained 1 -Enable
Set-SPUsageDefinition -Identity “Sandbox Requests” -DaysRetained 1 -Enable
Set-SPUsageDefinition -Identity “SQL Exceptions Usage” -DaysRetained 1 -Enable
Set-SPUsageDefinition -Identity “SQL IO Usage” -DaysRetained 1 -Enable
Set-SPUsageDefinition -Identity “SQL Latency Usage” -DaysRetained 1 -Enable
Set-SPUsageDefinition -Identity “SQL IO Usage” -DaysRetained 1 -Enable
Set-SPUsageDefinition -Identity “Task Use” -DaysRetained 1 -Enable
Set-SPUsageDefinition -Identity “Tenant Logging” -DaysRetained 1 -Enable
Set-SPUsageDefinition -Identity “Timer Jobs” -DaysRetained 1 -Enable
Set-SPUsageDefinition -Identity “User Profile ActiveDirectory Import Usage” -DaysRetained 1 -Enable
Set-SPUsageDefinition -Identity “Definition of usage fields for Education telemetry” -DaysRetained 1 -Enable
Set-SPUsageDefinition -Identity “Definition of usage fields for microblog telemetry” -DaysRetained 1 -Enable
Set-SPUsageDefinition -Identity “Definition of usage fields for service calls” -DaysRetained 1 -Enable
Set-SPUsageDefinition -Identity “Definition of usage fields for SPDistributedCache calls” -DaysRetained 1 -Enable
Set-SPUsageDefinition -Identity “Definition of usage fields for workflow telemetry” -DaysRetained 1 -Enable
Set-SPUsageDefinition -Identity “User Profile to SharePoint Synchronization Usage” -DaysRetained 1 -Enable
Como lo supe

Get-SPUsageDefinition | select Name

 

AND
Sharepoint Central Administration -> Monitoring -> Configure Usage and health data collection-> Log Collection Schedule.

Execute 2 timer jobs “Run Now”

  • Microsoft SharePoint Foundation Usage Data Import
  • Microsoft SharePoint Foundation Usage Data Processing

Saludos

Namespace prefix ‘ns1’ is not defined. XMLDocument June 17, 2016

Posted by juanpablo1manrique in SharePoint.
Tags: , ,
add a comment

Para solucionar este toca agregar todos los namespaces del mensaje

 

XmlNamespaceManager nsm = new XmlNamespaceManager(new NameTable());

nsm.AddNamespace(“SOAP-ENV”, “http://schemas.xmlsoap.org/soap/envelope/&#8221;);
nsm.AddNamespace(“ns1”, “http://schemas.xmlsoap.org/wsdl/soap/&#8221;);
nsm.AddNamespace(“xsd”, “http://www.w3.org/2001/XMLSchema&#8221;);
nsm.AddNamespace(“xsi”, “http://www.w3.org/2001/XMLSchema-instance&#8221;);
nsm.AddNamespace(“SOAP-ENC”, “http://schemas.xmlsoap.org/soap/encoding/&#8221;);
nsm.AddNamespace(“ns2”, “http://xml.apache.org/xml-soap&#8221;);
nsm.AddNamespace(“ns3”, “http://www.example.org/myns/&#8221;);

XmlNode node = xdoc.SelectSingleNode(“/SOAP-ENV:Envelope/SOAP-ENV:Body/ns1:metodo1/return/property1”,nsm);

 

Saludos

PD. Recomendado

http://www.freeformatter.com/xpath-tester.html#ad-output

 

Errores relacionados

‘XElement’ does not contain a definition for ‘XPathSelectElements’ and no extension method ‘XPathSelectElements’ accepting a first argument of type ‘XElement’ could be found (are you missing a using directive or an assembly reference?

failed to add token from distributed cache for … April 5, 2016

Posted by juanpablo1manrique in SharePoint.
Tags:
add a comment

failed to add token from distributed cache for

1.Servers in this farm
2.Distributed cache = ON