Hot answers tagged

16

It extracts one named parameter from the QueryString (URL) http://domainname.com/page.aspx?parameter1=xxx&parameter2=yyy var value=getQueryStringParameter('parameter1'); It is used in many examples and most of the time not necessary (and bloats your code) because SharePoint has multiple implementations in core libraries Usage depends on whether you ...


10

All you need to do is pass the Source parameter on the Query String. When the EditForm closes, it will always redirect to the page indicated in that parameter. For example: http://mysite/Lists/EditForm.aspx?ID=1&Source=http://mysite/default.aspx


7

I just realized that you are using the Search API. The example below is for basic SharePoint REST API. The following works for search: Created>2014-01-01-T00:00:00 So for your case: var queryUrl = "http://mydomain.com/sites/blabla/_api/search/query?querytext='ContentType:Factsheet ...


6

The Office Dev Patterns and Practices repo on GitHub has a great sample for provisioning custom web parts on the host web from inside of an app which should be a viable option for your situation. You could use this pattern to allow users to retrieve a custom configured web part and have it inserted into their host web allowing them to insert it at will (you ...


6

This blog post from Microsoft is highly linked to and describes what you want to do. I've used it before, these days I typically use jQuery and SPServices. Setting lookups typically requires you to pass in the Lookup ID value or the ID;Descriptor. Here's an actual example from a site of mine, it's setting a person/group field, not a lookup though. You ...


3

In JavaScript, there is a native SharePoint function called replaceOrAddQueryString(url, key, value) and returns the url. Ex: SP.Utilities.UrlBuilder.replaceOrAddQueryString("http://mysite", "level", "2") will return : http://mysite?level=2 SP.Utilities.UrlBuilder.replaceOrAddQueryString("http://mysite?level=2", "sublevel", "1") will return : ...


3

If you want to manually navigate to the doc set, here's the correct URL: ...


2

To avoid this, use CAML query and post it in the request body. Use a CAML query builder to build the query. This doesn't have restrictions on the length. This might become long and repetitive. But AFAIK, there is no other way to post huge request bodies in the request URL. CAML query: <Query> <Where> <Or> <Eq> ...


2

The XSLTListViewWebPart can read querystring parameters, you could try this: .../Forms/AllItems.aspx?FilterName=Title&FilterMultiValue=*something* FilterName is a column. Hope this helps


2

You need to replace L&M with L&amp;M One way to do this is to use HttpUtility.HtmlEncode


2

Problem solved by adding a Choice Filter webpart on the page (hidden) with the same values that you use in the querystring. The 2nd filter webpart captures the querystring value.


2

Use %26 instead of &. It helped me. Like here: <Edit>_Layouts/project/custom Form.aspx?PageMode=Edit%26WFTask=1</Edit>


2

As far as I know you can't, there is no built in OOB solution for this (at least not in 2010). What you can do instead is to use jQuery and some JavaScript, like this: $(function() { var fields = {}; $('.ms-formbody').each(function() { var name = $(this).html().match(/FieldInternalName="([A-Za-z0-9]+)"/); if (name) fields[name[1]] = ...


2

My first guess is, have you specified redirect url while registering your app in appregnew.aspx page? For more info check this link Basically what is happening is when you use bookmark to navigate to your app, the context token has expired. So you need to redirect to sharepoint site first to re-authenticate. Hope this helps.


1

Found the answer (quite simply using the IntelliSense Visual Studio). Here is what I did: System.Collections.Specialized.NameValueCollection paramCollection = HttpUtility.ParseQueryString(this.Request.UrlReferrer.AbsoluteUri); string param = paramCollection["param"].Replace("|", @"\"); It worked!!


1

Filter web parts require enabling SharePoint Enterprise site collection feature. That means this belongs to only enterprise SharePoint versions.


1

Updated the information: when I do follow the link: http://arsalkhatri.wordpress.com/2012/01/07/external-list-with-bcs-search-filters-finders/ then I convert my SP2013 external listview webpart into Server Render the filter work fine, so why?


1

Hi Mark it's hard to find documentation for this but at the end I resolved using this pattern: resultspage.aspx#Default={"k":"*","r":[{"n":"owstaxIdYourManagedProp","t":["cf32e33f-7ca2-470d-956b-29368e54e736"],"o":"OR","k":false,"m":{"cf32e33f-7ca2-470d-956b-29368e54e736":"TermName"}}]} It's important to note that: k:* basically it means "all documents" ...


1

The ID parameter name should be already in use, try following.. Replace <ParameterBinding Name="ID" Location="QueryString(ID)" DefaultValue="0"/> With <ParameterBinding Name="DocumentId" Location="QueryString(ID)" DefaultValue="0"/> And than replace <FieldRef Name="Document" LookupId="TRUE"/> <Value ...


1

There is the Method String queryString = Request.QueryString["search"]; If the url would be like .....search=45 this would return 45.


1

Hi Mark it's hard to find documentation for this but at the end I resolved using this pattern: resultspage.aspx#Default={"k":"*","r":[{"n":"owstaxIdYourManagedProp","t":["cf32e33f-7ca2-470d-956b-29368e54e736"],"o":"OR","k":false,"m":{"cf32e33f-7ca2-470d-956b-29368e54e736":"TermName"}}]} It's important to note that: k:* basically it means "all documents" ...


1

Will this work for you? <asp:LinkButton runat="server" ID="lbJan" OnClick="lbMonth_Click" Text="ClickMe' CommandArgument="1" > protected void lbMonth_Click(object sender, EventArgs e) { string redirect = "<script>window.open('/Pages/Page1.aspx?sID=" + e.CommandArgument.ToString() + "' );</script>"; Response.Write(redirect); }


1

Querying and manipulating the DOM elements can be done in SPO Page through App part (Client hosted web part) even though its run inside the iframe on the hosted web page. To do this, you need to wire-up the web part properties with query string as suggested by John-M and I tried few approaches and found none except this idea. SP.RequestExecutor.js doesn't ...


1

The answer is: HttpContext.Current.Request.QueryString Also make sure your page inherits from either LayoutPageBase or UnsecuredLayoutPageBase whic are the base classes for application pages.


1

Hey you can manipulated the sorting in the query string like this: https://site/search/results.aspx#Default={"k":"SearchWord","o":[{"d":0,"p":"ManagedProperty"}]} I'm sure you can do more advanced sorting as well, here is a good reference: Sort search results


1

Don't use any special characters. In my experience it always appears that the query parser is breaking the query at the hyphen. It also negates the query term (using -term will remove results with that term).


1

Append IsDlg=1 to your url string


1

Use javascript by adding a Content Editor to the page or adding it to the markup itself. I did something similar, picked up ContactId from Query String. Picked up this code from here <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script> <script type="text/javascript"> ...


1

To me it sounds like you want a normal link (a-tag) to the other app. One way to achieve this is by getting the app tile from host web and create a link to the tile target, something like this: _api/Web/AppTiles?$filter=Title eq 'Your app title'&$select=Target (note you need to use AppContextSite endpoint.) Then select the first result, and create an ...


1

Based on month changes, you should be passing a complete query including query strings (possibly refiners) so page load shouldn't affect the search results. var startdate= JSRequest.QueryString["MyStartDate"]; var enddate= JSRequest.QueryString["MyEndDate"]; var filtersArray = []; filtersArray.push("MyStartDate=" + startdate); ...



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