Tag Info

Hot answers tagged

5

I think @LeopoldLerch is on to the correct approach. Try doing the following Guid siteId = SPContext.Current.Site.ID; SPUserToken systemAccountUserToken = SPContext.Current.Site.SystemAccount.UserToken; HttpContext currentUserContext = HttpContext.Current; if (SPContext.Current != null) HttpContext.Current = null; ...


5

It might look like a property, but actually the setter of that property calls a method named SetAllowUnsafeUpdates(value) which code is as follows: private void SetAllowUnsafeUpdates(bool allowUnsafeUpdates) { this.Request.SetIgnoreCanary(allowUnsafeUpdates); } SetIgnoreCanary sets to ignore Canary (Canary is something that refers to a method of buffer ...


5

You will need to use $.Deferred() as well as $.when(). Modify appendUserInfo() to be like the following: function appendUserInfo(userId) { var d = $.Deferred(); context.load(items, 'Include(EMail)'); context.executeQuerAsync(function(){ if(items.get_count() > 0) { var item = items.itemAt(0); emailString = ...


5

CSOM and REST was introduced in SP 2010 so you wont be able to use that with 2007. SOM is an option but requires that your code runs on the servers of each farm. SharePoint Web Services will be your best option if you need to support all three versions with the same code from client computers. Lists Web Service (/_vti_bin/Lists.asmx) for getting libraries ...


4

Try to delete the current httpcontext before elevating (but do not forget to remember it and set it back like var storedContext = HttpContext.Current; HttpContext.Current = null; <Do something> HttpContext.Current = storedContext; Because it seems to use still your curentUsers Credentials when calling the search service (which it still does in ...


4

Open with Explorer does not appear on lists, only in document libraries. Your list options would be Connect to Outlook, Export to Excel, Open with Access, Open with Project (depending on your SKU).


4

Groups define security boundaries. A group is a set of term sets that all share common security requirements. Only users who are designated as contributors to a specific group can manage term sets that belong to the group or create new term sets within it. Organizations should create unique groups for term sets that will have unique access or security needs. ...


3

Here you go: $spWeb = Get-SPWeb -Identity http://<sitecollection>/<subsite> $lList=$spWeb.Lists["<ListName>"] $spItems = $lList.GetItems() foreach($spItem in $spItems) { $spItem["Date"] = $spItem["Created"].AddYears(2) $spItem.Update() }


3

Yes it is. Please see this TechNet documentation for when a full crawl is needed. A Search service application administrator or site collection administrator added or changed a managed property. A full crawl of all affected content sources is required for the new or changed managed property to take effect.


3

In your code you seem to be adding a new SPWeb using (SPWeb newWeb = web.Webs.Add(.......)) As far as I know, the Add method is actually a non-blocking one: the method can return before the web is actually fully provisioned. With that in mind, the issue seem to be more comprensible. Your code is trying to update the web while it is still begin ...


3

After some intense debugging I am answering my own question. And wasted +50 StackOverflow points on this, so am an idiot. I copied and de-minified the original (global) SharePoint RenderGroupTemplate function The relevant lines: b[d+".groupHeader"]=true; a+=spMgr.RenderFieldByName(c,d,b,h); delete b[d+".groupHeader"]; Became: ...


3

CSOM: will work in SP online, SP 2010, 2013 and most probably 2016 REST: will work in SP online, SP 2010, 2013 and most probably 2016 OOTB Web service: will work in SP 2007, 2010, 2013 but maybe not in 2016 (and maybe not with future versions of SP online) Creating your own Web service with SOM: will work in SP 2007, 2010, 2013 and 2016


3

You can use the SP.ListItemCreationInformation.set_folderUrl method (MSDN). And here is a simple example: var clientContext = SP.ClientContext.get_current(); var list = clientContext.get_web().get_lists().getByTitle('Custom'); var itemCreateInfo = new SP.ListItemCreationInformation(); itemCreateInfo.set_folderUrl('/Lists/Custom/Folder'); var listItem = ...


2

The "DocIcon" property will not get you the icon itself but the file extension. You can use mapToIcon method from the SPWeb object in JavaScript to get the image url. Example : http://onlinecoder.blogspot.ca/2014/03/get-oob-document-type-icon-using.html


2

I finally figured out what was wrong. It was our old web application, maybe it somehow got damaged during the server crash. So I created a new web application and tested the timer there. It worked fine. Hope this can help somebody out there.


2

There are couple of approaches to achieve this: Using Client Side Rendering Using CSR you can manipulate how your column data is visualized. But you'll need to manually put the JSLink everywhere. Use Text Column and do validation You can use a text column instead of number and do a below column validation: =ISNUMBER([ColumnName]+0)


2

Seems currently not possible. The Recycle method is not available via CSOM or REST API. The following items can be recycled (as of REST metadata on my SPO tenant): Folder File AppInstance ListItem List WorkflowTask


2

For such situations I use InfoPath to customise the list form. I use an XML file as a secondary data source. The XML file has nodes for each field I want to watch. A form load rule writes all the current values to the XML. The Save button has a rule for each field I'm watching. If the form field and the XML field are not the same, a message is appended to a ...


2

someone set it already in Manage Profile Service > User Profile Service > setup my Site (My site HOST) Changed it to correct URL.


2

You need to render the rich text. Just add STSHtmlDecode like in this example. <div id="trimmedDetailsDiv" class="newsListItemBody" style="padding-right: 0px; color:#656565; font-size:15px; padding-bottom: 25px;"> _#= STSHtmlDecode(shortDescription.value) =#_ </div> SharePoint 2013 - Working with Display Template for Content Search Web ...


2

Try the following: if (document.forms["aspnetForm"]["MSOLayout_InDesignMode"].value == 1) { //do your stuff } If you want to be sure-sure, you can double check with this property: document.forms["aspnetForm"]["MSOSPWebPartManager_DisplayModeName"].value which should have a value of "Design" if a page is in edit mode, or "Browse" if it's in display ...


2

This is what we are using currently in one of our projects to check if a page is in edit mode or not: // An accesser indicating whether or not the current page is in design mode. function inDesignMode () { var result = (window.MSOWebPartPageFormName != undefined) && ((document.forms[window.MSOWebPartPageFormName] && ...


2

You can do it through Welcome Page option but i guess for that you will need to activate Publishing feature at site level. The other options are If you want to set a Custom Page as a Home Page in a typical SharePoint Team site, you can simply do that by Opening the Page and selecting Page tab -> Make HomePage button to set this particular page as default ...


2

SPWebCollection.Add calls a method named CreateWeb. That method is synchronous and is as follows: private SPWeb CreateWeb(string strUrl, string strTitle, string strDescription, uint nLCID, string strWebTemplate, bool bCreateUniqueSubweb, bool bConvertIfThere, Guid webId, Guid rootFolderId, bool createSystemCatalogs, Guid appInstanceId, string ...


2

Try running psconfig.exe -cmd secureresources It is a command that should make sure that services in SharePoint (or, the accounts running them) has correct permissions on registry keys


2

In my opinion, I'd build it for growth off the bat and have each department in a site collection, with a managed path--"sites" is fine http://sharepoint/sites/hr http://sharepoint/sites/finance http://sharepoint/sites/operations With each site collection there will be a site collection specific, generated set of SharePoint groups--Visitors, Members, and ...


2

The problem doing it like that is that you have no way of disposing the SPSite object outside of the SPWeb using statement as the SPSite object is encapsulated in the "wrong" using statement. So in your code example your SPWeb object will be automatically disposed when the code leaves the using statement, but the SPSite object will remain in memory and leak ...


2

it is no process at all, it is just a flag. But you should avoid it due to security reasons. If you place the Digest-Control from SharePoint on your page or do a SPUtility.ValidateDigest() by yourself in code, you should be able to update without AllowUnsafeUpdates


2

what i am thinking, if you are doing some development with SharePoint Online / Office 365, then you can see the version 16 for client dll. Office 365 always ahead of race, currently if you see the version for office 365 it is 16. So that make sense, if their some development or development tool installed for office 365. check this one ...


2

If you're using SharePoint 2013 it should be something like: ({SearchBoxQuery} XRANK(cb=2000) Lastname:{SearchBoxQuery}) XRANK(cb=1000) Firstname:{SearchBoxQuery} Boosting match on last name by 2000, on first name by 1000 and on both by 3000



Only top voted, non community-wiki answers of a minimum length are eligible