get current user ASP.NET Forms August 1, 2017
Posted by juanpablo1manrique in SharePoint.add a comment
HttpContext.Current.User.Identity.Name
Read CSV file Powershell March 29, 2017
Posted by juanpablo1manrique in SharePoint.add a comment
$unarchivo = “c:/afd.csv”
param ([string]$unarchivo = $(throw “variable vacia”))
import-csv $unarchivo | foreach-object {
$USRPrincipalName = $_.Column1
$OldPrimary = $_.Column2
$NewPrimary = $_.Column3
#el powershell deseado
Set-Mailbox -identity $UserPrincipalName -EmailAddresses @{add=”SMTP:” + “$NewPrimary”}
}
Update Enterprise Keyword Column OnPremise : TaxKeyword March 10, 2017
Posted by juanpablo1manrique in SharePoint.add a comment
Hola,
Muy buenas,
private static void TestUpdateKeyWords() { using (SPSite site = new SPSite(urlSite)) { using (SPWeb web = site.OpenWeb("subweb")) { SPList list = web.Lists.GetList(new Guid("00000-ad33-4d53-91c0-6310ba1baf09"), true); SPListItem item = list.GetItemById(228); //CheckOut item.File.CheckOut(); //Set Field SPField field = list.Fields.GetFieldByInternalName("TaxKeyword"); var taxKeywordField = (TaxonomyField)field; string[] values = { "keyword1","keyword2" }; var keywords = values.Select(value => EnsureKeyword(taxKeywordField, value)).ToList(); string strKeyWordsToInsert = GetTermsString(keywords); item[taxKeywordField.Id] = strKeyWordsToInsert; item.Update(); //CheckIn item.File.CheckIn("Actualizacion datos", SPCheckinType.MajorCheckIn); } } } private static Term EnsureKeyword(TaxonomyField taxField, string name) { int DefaultLanguage = 1033; TaxonomySession session = new TaxonomySession(taxField.ParentList.ParentWeb.Site); var termStore = session.TermStores[0]; var keywords = termStore.KeywordsTermSet.GetAllTerms(); var result = keywords.Where(k => k.Name == name); var keyword = result.FirstOrDefault(); if (keyword != null) { return keyword; } keyword = termStore.KeywordsTermSet.CreateTerm(name, DefaultLanguage, Guid.NewGuid()); return keyword; } private static string GetTermString(Term term) { return string.Format("-1;#{0}{1}{2}", term.Name, "|", term.Id); } private static string GetTermsString(IEnumerable<Term> terms) { var termsString = terms.Select(GetTermString).ToList(); return string.Join(";#", termsString); }
Para ver la version Online
http://sharepoint.stackexchange.com/questions/108716/setting-value-of-enterprise-keywords-using-csom
Saludos,
UnauthorizedAccessException SharePoint _api February 28, 2017
Posted by juanpablo1manrique in SharePoint.add a comment
Hola amigos,
Me ha pasado que
UnauthorizedAccessException “_api/SP.UserProfiles.PeopleManager”
Pense que era permisos de algo pero descubrí que tambien fallaba,
_api/web/lists
_api/search/query?querytext=’SharePoint’
_api/SP.UserProfiles.PeopleManager
Pero funcionaba con un usuario administrador,
Al verificar …
site settings->site permissions->permissions level->read->
Integration client features
Use remote interface
Estaban deshabilitadas, que mano de vueltas para habilitar estos dos niveles de permisos,
Felices fiestas
Wait for an array of deferreds January 23, 2017
Posted by juanpablo1manrique in SharePoint.add a comment
var deferredArray = [];
for(var i = 0; i < data.length; i++)
{
deferredArray.push(processItem(data[i]));
}
$.when.apply($, deferredArray).then(
function () {
deferMayor.resolve(collReturn)
},
function () {
deferMayor.reject(args);
});
);
WebHttpBinding “HttpContext.Current” null WCF SharePoint October 20, 2016
Posted by juanpablo1manrique in SharePoint.Tags: SharePoint
add a comment
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,
Parallax heart October 7, 2016
Posted by juanpablo1manrique in SharePoint.add a comment
.bgimg-1, .bgimg-2, .bgimg-3 {
position: relative;
opacity: 0.65;
background-attachment: fixed;
background-position: center;
background-repeat: no-repeat;
background-size: cover;
}
http://www.w3schools.com/howto/howto_css_parallax.asp
SPContext.Current == null August 30, 2016
Posted by juanpablo1manrique in SharePoint.Tags: SharePoint
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: SharePoint
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
BootStrap Heart July 14, 2016
Posted by juanpablo1manrique in SharePoint.Tags: BootStrap
add a comment
BootStrap Heart
Grid size | Grid class | Offset class | Screen size |
---|---|---|---|
Extra small | col-xs-* | col-xs-offset-* | 0px + |
Small | col-sm-* | col-sm-offset-* | 768px + |
Medium | col-md-* | col-md-offset-* | 992px + |
Large | col-lg-* | col-lg-offset-* | 1200px + |