Hi,
Does anybody know if the REST APIs and SOAP services are supported in SharePoint online ? I am having office 365 E3 license.
Regards
Deepak
Hi,
Does anybody know if the REST APIs and SOAP services are supported in SharePoint online ? I am having office 365 E3 license.
Regards
Deepak
Hi all,
i am facing error following error on the page.Please give reply if you know answer.
Getting results failed: Microsoft.Office.Server.Search.Query.InternalQueryErrorException: Search has encountered a problem that prevents results from being returned. If the issue persists, please contact
your administrator.
at Microsoft.Office.Server.Search.Administration.SearchServiceApplicationProxy.ThrowGenericQueryException(String operationName)
at Microsoft.Office.Server.Search.Administration.SearchServiceApplicationProxy.DoSpLoadBalancedUriWsOp[T](WebServiceBackedOperation`1 webServiceCall, Int32 timeoutInMilliseconds, Int32 wcfTimeoutInMilliseconds, String operationName)
at Microsoft.Office.Server.Search.Administration.SearchServiceApplicationProxy.DoWebServiceBackedOperation[T](String operationName, Int32 timeoutInMilliseconds, Int32 wcfTimeoutInMilliseconds, WebServiceBackedOperation`1 webServiceCall)
at Microsoft.Office.Server.Search.Administration.SearchServiceApplicationProxy.Execute(QueryProperties properties)
at Microsoft.Office.Server.Search.Query.Query.ExecuteQuery()
at Microsoft.Office.Server.Search.Query.SearchExecutor.ExecuteQueryInternal(Query query)
at Microsoft.Office.Server.Search.Query.SearchExecutor.ExecuteQuery(Query query)
at Microsoft.Office.Server.Search.Query.SearchExecutor.ExecuteQueries(Dictionary`2 queries, Boolean handleExceptions)
at Microsoft.Office.Server.Search.WebControls.ScriptApplicationManager.GetSyncResult(String queryGroupName)
at Microsoft.Office.Server.Search.WebControls.DataProviderScriptWebPart.GetInitialResult()
Regards
VeerendraNadh
If I uncheck "Available For Tagging" from a global termset can I still access it programmatically? The answer would appear to be "No". I have a console app that uses
TaxonomySession session = new TaxonomySession(site, true); var termStore = session.TermStores[0]; termStore.UpdateCache(); var group = GetTaxonomyGroupByName(termStore.Groups, "Global Termsets"); TermSet globalTermSet = group.TermSets.FirstOrDefault<TermSet>(e => e.Name.Equals("My termset", StringComparison.CurrentCultureIgnoreCase)); OR TermSet gts = group.TermSets["My termset"];
If I uncheck "Available for Tagging" this this fails. When I re-select "Available for Tagging", it works.
Obviously, this is the way SP is designed (I think) but my question is why? I don't want my navigation termset being used for tagging. I have a different termset for that. This suggests that tagging also controls api visibility to the termset. Is this something that other experienced developers can comment on?
Thanks!
Hi, I want to set the delay of a SharePoint 2013 redirect page layout to 0 sec, but still be cloud compliant. The default is 5 sec, and it doesn't seem obvious how to edit this, as the delay setting is not a property of the page, as is the case with the RedirectURL. This is what I've been doing:
1. Created a page layout from design manager, using the redirect page content type and using seattle as master.
2. Downloaded, and added the html in between MY EDIT START/END comments, this is the html found in the native RedirectPageLayout.aspx, in an attempt to override. This seems to be the incorrect way to go about this though and where I'm hoping to get help.
<!--MS:<asp:ContentPlaceHolder id="PlaceHolderMain" runat="server">-->
<!-- MY EDIT START -->
<!--MS:<PublishingWebControls:RedirectControl SecondsBeforeRedirect="0" runat="server"/>-->
<!--ME:<PublishingWebControls:RedirectControl>-->
<!-- MY EDIT END -->
<div>
<!--CS: Start Page Field: Title Snippet-->
<!--SPM:<%@Register Tagprefix="PageFieldTextField" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=15.0.0.0,
Culture=neutral, PublicKeyToken=71e9bce111e9429c"%>-->
<!--SPM:<%@Register Tagprefix="Publishing" Namespace="Microsoft.SharePoint.Publishing.WebControls" Assembly="Microsoft.SharePoint.Publishing,
Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"%>-->
<!--MS:<Publishing:EditModePanel runat="server" CssClass="edit-mode-panel">-->
<!--MS:<PageFieldTextField:TextField FieldName="fa564e0f-0c70-4ab9-b863-0177e6ddd247" runat="server">-->
<!--ME:</PageFieldTextField:TextField>-->
<!--ME:</Publishing:EditModePanel>-->
<!--CE: End Page Field: Title Snippet-->
</div>
<div>
<!--CS: Start Page Field: Redirect URL Snippet-->
<!--SPM:<%@Register Tagprefix="PageFieldUrlField" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=15.0.0.0,
Culture=neutral, PublicKeyToken=71e9bce111e9429c"%>-->
<!--MS:<PageFieldUrlField:UrlField FieldName="ac57186e-e90b-4711-a038-b6c6a62a57dc" runat="server">-->
<!--PS: Start of READ-ONLY PREVIEW (do not modify)--><div align="left" class="ms-formfieldcontainer"><div class="ms-formfieldlabelcontainer"
nowrap="nowrap"><span class="ms-formfieldlabel" nowrap="nowrap">Redirect URL</span></div><div class="ms-formfieldvaluecontainer"><a href="http://www.example.com">Link to sample
web site.</a></div></div><!--PE: End of READ-ONLY PREVIEW-->
<!--ME:</PageFieldUrlField:UrlField>-->
<!--CE: End Page Field: Redirect URL Snippet-->
</div>
<!--ME:</asp:ContentPlaceHolder>-->
3. Created a page from this page layout
When I then click the link to the new page, I get an unexpected error, and the first exception found in the ULS logs reads:
Caught a thread abort exception in TemplateRedirectionPage.ProcessRequest, the exception may be expected. stack trace=
at System.Threading.Thread.AbortInternal()
at System.Threading.Thread.Abort(Object stateInfo)
at System.Web.HttpResponse.AbortCurrentThread()
at System.Web.HttpResponse.Redirect(String url, Boolean endResponse, Boolean permanent)
at Microsoft.SharePoint.Utilities.SPUtility.Redirect(String url, SPRedirectFlags flags, HttpContext context, String queryString)
at Microsoft.SharePoint.Publishing.Design.DesignUtilities.ShowPreviewWithStatus(String masterUrl)
at T_fa2bb6b8_abfa_44f9_8afc_e8d707e8c661.CreateInstance()
at System.Web.HttpRuntime.FastCreatePublicInstance(Type type)
at System.Web.Compilation.BuildResultNoCompileTemplateControl.CreateInstance()
at System.Web.Compilation.BuildManager.CreateInstanceFromVirtualPath(VirtualPath virtualPath, Type requiredBaseType, HttpContext context, Boolean allowCrossApp)
at System.Web.UI.PageHandlerFactory.GetHandlerHelper(HttpContext context, String requestType, VirtualPath virtualPath, String physicalPath)
at Microsoft.SharePoint.Publishing.TemplateRedirectionPage.ProcessRequest(HttpContext context)
Later there is also a FileNotFoundException.
Funny thing is that if I leave out my attempt to override the 5sec redirect, the page renders with just a clickable link on the page, without it redirecting at all.
So question is, does anyone know how to perform this type of redirect and setting the delay to 0sec? I shouldn't create my own custom RedirectPageLayout0sec.aspx file and then inherit right? Not very cloud friendly if I got this right.
EDIT: This is the section in the native SP RedirectPageLayout that I want to override:
<asp:Content ContentPlaceholderID="PlaceHolderMain" runat="server">
<PublishingWebControls:RedirectControl SecondsBeforeRedirect="5" runat="server"/>
<div class="redirect">
<SharePointWebControls:FormField FieldName="RedirectURL" runat="server"/>
<PublishingWebControls:RichImageField FieldName="PublishingRollupImage" runat="server"/>
<PublishingWebControls:EditModePanel runat="server" CssClass="edit-mode-panel title-edit">
<SharePointWebControls:TextField runat="server" FieldName="Title"/>
</PublishingWebControls:EditModePanel>
</div>
</asp:Content>
Any pointers appriciated!
My question is simple and hopefully, the answer that I'm looking for simpler:
- How do I create a Visual Studio Solution for a Custom/Visual Web Part for SharePoint 2013 using XsltListViewWebPart or ListViewWebPart?
I would like to deploy a web part to my farm so users can have this web part to reuse in their websites.
Hi All,
I am attempting to add a web part to a wiki page (SitePages/Home.aspx in this case), using the code below.
private void addWPToPage(ClientContext cc, Web web) { try { Microsoft.SharePoint.Client.File file = web.GetFileByServerRelativeUrl(web.ServerRelativeUrl + "/SitePages/Home.aspx"); cc.Load(file); cc.ExecuteQuery(); LimitedWebPartManager wpm = file.GetLimitedWebPartManager(PersonalizationScope.Shared); cc.Load(wpm.WebParts, wps => wps.Include(wpp => wpp.WebPart.Title)); cc.ExecuteQuery(); List targetList = web.Lists.GetByTitle("General Documents"); cc.Load(targetList); cc.ExecuteQuery(); string webPartXMLTemplate = "<webParts>" +"<webPart xmlns='http://schemas.microsoft.com/WebPart/v3'>" +"<metaData>" +"<type name='Microsoft.SharePoint.WebPartPages.XsltListViewWebPart, Microsoft.SharePoint, Version=16.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c' />" +"<importErrorMessage>Cannot import this Web Part.</importErrorMessage>" +"</metaData>" +"<data>" +"<properties>" +"<property name='ShowWithSampleData' type='bool'>False</property>" +"<property name='Default' type='string' />" +"<property name='NoDefaultStyle' type='string' null='true' />" +"<property name='CacheXslStorage' type='bool'>True</property>" +"<property name='ViewContentTypeId' type='string' />" +"<property name='XmlDefinitionLink' type='string' />" +"<property name='ManualRefresh' type='bool'>False</property>" +"<property name='ListUrl' type='string' />" +"<property name='ListId' type='System.Guid, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'>" + targetList.Id.ToString() + "</property>" +"<property name='TitleUrl' type='string'></property>" +"<property name='EnableOriginalValue' type='bool'>False</property>" +"<property name='Direction' type='direction'>NotSet</property>" +"<property name='ServerRender' type='bool'>False</property>" +"<property name='ViewFlags' type='Microsoft.SharePoint.SPViewFlags, Microsoft.SharePoint, Version=16.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c'>Html, TabularView, Hidden, Mobile</property>" +"<property name='AllowConnect' type='bool'>True</property>" +"<property name='ListName' type='string'>{" + targetList.Id.ToString() + "}</property>" +"<property name='ListDisplayName' type='string' />" +"<property name='Title' type='string'>General Documents</property>" +"</properties>" +"</data>" +"</webPart>" +"</webParts>"; WebPartDefinition newWebPart = wpm.ImportWebPart(webPartXMLTemplate); var wp = wpm.AddWebPart(newWebPart.WebPart, "wpz", 0); cc.ExecuteQuery(); } catch (Exception ex) { } }
The web part is added to the page successfully, however it is not visible on the page. If I change the zoneId from 'wpz' to 'Bottom', the web part is added and is visible on the page, but not in the area I want it to be and it has limitations.
The same question has previously been asked at the link below without a resolution
http://stackoverflow.com/questions/27268492/how-to-add-a-web-part-into-a-sitepages-home-aspx-using-csom
Is this possible and if so, how can it be achieved?
Thanks
David
Dear all,
Im trying to connect to a SharePointOnline 2013. In my C# Console Application everything works fine, but if I try (nearly) the same code in a Universal App, it is not possible to create multiple instances of a ClientContext (nor setting the credentials multiple times)...
Im using the Microsoft.SharepointOnline.CSOM Version: 16.1.4727.1204 (released today 11.12.2015)
Here the console application which works fine:
namespace ConsoleApplication1 { class Program { static void Main(string[] args) { UseContextMultipleTime(); UseContextMultipleTime(); } public static void UseContextMultipleTime() { using (var context = new ClientContext("https://something.sharepoint.com")) { var securePassword = new SecureString(); foreach (char c in "password".ToCharArray()) securePassword.AppendChar(c); context.Credentials = new SharePointOnlineCredentials("username", securePassword); try { context.ExecuteQuery(); string status = "OK"; } catch (Exception ex) { string test = ex.ToString(); } } } } }
and below the Universal App version, whichs crashs in the second method call:
namespace App2 { public sealed partial class MainPage : Page { public MainPage() { this.InitializeComponent(); UseContextMultipleTime(); UseContextMultipleTime(); } public void UseContextMultipleTime() { using (var context = new ClientContext("https://something.sharepoint.com")) { context.Credentials = new SharePointOnlineCredentials("username", "password"); try { context.ExecuteQueryAsync().Wait(); string status = "OK"; } catch (Exception ex) { string test = ex.ToString(); } } } } }
I already invested a lot of time and tried multiple variants like global variable context with disposing instead of using etc... interesting is that if you set the credentials only once, then it will work..
Does anybody of you know a solution for this problem? I will appreciate every kind of hints...
Thanks in advance,
Lorenz
i am looking for solution to Copy list item from one list to another list with attachment using visual studio workflow
i am able to copy list items but not attachment .if any one know how to copy attachment content from list one to list two
Hi,
Below is the code to update the table in sql database
code for Interface
[OperationContract]
[WebGet(UriTemplate = "UpdatePresidentById/{id}",
ResponseFormat = WebMessageFormat.Json)]
void UpdatePresidentById(string id);
cs code
public void UpdatePresidentById(string id)
{
string connStr = @"Data Source=WIN-941LO3JBRJG\SQLEXPRESS;Initial Catalog=Northwind;Integrated Security=True;";
using (SqlConnection con = new SqlConnection(connStr))
{
string name = "zainobeta2";
//DataTable dt = new DataTable();
con.Open();
SqlCommand cmd = new SqlCommand("Update tblEmployee set Name = @name where ID=@id", con);
cmd.Parameters.AddWithValue("@name", name);
cmd.Parameters.AddWithValue("@id", id);
cmd.ExecuteNonQuery();
// con.Close();
cmd.Dispose();
}
}
jquery code
function updatePresidentsDataById() {The table is not getting updated even after using PUT, also how to insert new values in the table using wcf rest jquery in sharepoint
Any suggestion plz, got stuck in above requirement for days.
Hello!
I have a question about sorting and filtering in an XsltListViewWebPart that has a query string parameter. The situation is as following:
There are two lists (ListA and ListB), ListB has a lookup field referencing ListA. The customer wants to be able to see on the DispForm of ListA records from ListB that reference the current item in ListA. The proposed solution was to place an XlstListViewWebPart to the DispForm of ListA and modify its query so that it selects only those items from ListB that reference the current item in ListA by add a query string bound parameter.
The necessary modification has been made with the following added to the ParameterBindings
<ParameterBinding Name="ParentItemId" Location="QueryString(ID)" DefaultValue="0" />
and the following query being used by the web-part
<Query><Where><Eq><FieldRef Name="ListARef" LookupId="TRUE" /><Value Type="Integer">{ParentItemId}</Value></Eq></Where><OrderBy><FieldRef Name="ID" Ascending="FALSE"/></OrderBy></Query>
(the person who made the prototype used SP Designer for the modifications)
So, everything works as desired until either sorting or filtering is used. The Web-part sends and an Ajax request to inplview.aspx to refresh its data but theParentItemId parameter isn't passed in it, consequently zero records are returned.
My question is, is it possible to make the proposed solution work as needed by making the Web-part to pass in its requests to inplview.aspx (variants with JS-hooks are acceptable) or the required result is unfeasible with this method and alternative solutions should be sought?
I have an assets library list where many items are visible in the 'Manage files which have no checked in version' part of the list settings. My initial thought was I would do as I usually do and take ownership of them and then check them in. But there are no checkboxes to select an item to take ownership of it. The items are all visible in the main list view too, and they don't have a checked out icon and don't have anyone listed in the 'checked out to' column, even though they do have someone listed n the 'checked out to' column in the 'Manage files which have no checked in version' section.
When I select the item in the list the check out and check in buttons are bother disabled. So there is no way to do either.
Whenever I add new items into this list they always get stuck in this state of not checked in or checked out. This is a problem because this a media library for a public website, so any new items can not be seen by anonymous users, since they never become fully checked in. Even though the version number says 1.0, it still does not show to anonymous users due to this strange check out check in corruption on the list.
Is there a solution to fix this corruption or do I need to create a new list and move all the content to that and then delete this list?
Dear All,
I had written the code to retrieve the list items using JSOM ,But found no luck can any one help me the issue in below code
<script> SP.SOD.executeFunc('sp.js', 'SP.ClientContext', retrieveListItems); function retrieveListItems() { var clientContext = new SP.ClientContext.get_current(); var oList = clientContext.get_web().get_lists().getByTitle('CalerndarExecution'); var camlQuery = new SP.CamlQuery(); var camlQuery = new SP.CamlQuery(); camlQuery.set_viewXml("<View><Query><OrderBy><FieldRef Name='Function' Ascending='TRUE' /></OrderBy></Query></View>";); this.collListItem = oList.getItems(camlQuery); clientContext.load(collListItem); clientContext.executeQueryAsync( Function.createDelegate(this, this.onQuerySucceeded),Function.createDelegate(this, this.onQueryFailed) ); } function onQuerySucceeded(sender, args) { var listItemInfo = ''; var listItemEnumerator = collListItem.getEnumerator(); while (listItemEnumerator.moveNext()) { var oListItem = listItemEnumerator.get_current(); listItemInfo +=' <strong>Title:</strong> ' + oListItem.get_item('Function') +'<br />'; } $("#p").val(listItemInfo); } function onQueryFailed(sender, args) { alert('Request failed. ' + args.get_message() +'\n' + args.get_stackTrace()); }</script><p></p>
Hi,
Your quick help is appreciated.
I have a site collection with custom master page. But some sub sites were created with 2013 Team site template under the site collection.
So I had to make some change in the custom master page in site collection. I then went ahead and applied that change to all sub sites (by checking the boxes under Site settings (at site collection level) --> Look & Feel --> Master Pages --> Site Master Page & System Master Page).
Now the sub sites are showing the custom master page with contents hidden. What should I do to revert back to old position where the site collection should have the custom master page (with the change I made) and sub sites going to the format it was having before.
Regards,
Suresh.
Hello Guys,
I have developed responsive applications in SharePoint so that, layout varies depending on the the device, this is the era of mobiles, So users will not have full satisfaction using a mobile, they'd prefer a native application than opening the SP application
in a browser. After going through, PhoneGap is the best way to create Native applications for IOS, Android, Windows with only HTML, JS knowledge.
Now, as I wanted to start to create Web Mobile App, how can I integrate the App created using PhoneGap with the content in SharePoint.
Wanted to discuss on authentication to SharePoint , after that everything will be familiar to SP Development. (SPurl + "_vti_bin/authentication.asmx")
Thanks,
Hemanth Anumolu.
Hi,
I am referencing the SPServices in SharePoint 2013 custom Master Page.
<script type="text/javascript" src="../SiteAssets/js/jquery.js"></script><!-- <script type="text/javascript" src="../SiteAssets/js/menu.js"></script>--><script type="text/javascript" src="../SiteAssets/js/jquery.SPServices-0.7.2.js"></script><script type="text/javascript">
Except SPService other files are working properly. But i am not able to perform the operations of SPService.
Unable to get property 'SPGetCurrentUser' of undefined or null reference
Please let me know how can i solve this issue?
Hi
I'd like to know if there any way to count the quantity of numbers likes that any specific user given.
I find the way to count likes received, This is inside the News table, but I like to find a likes given.
Any Idea?
Regards
RAmiro
Ramiro B
Hello guys,
Today I wanted to understand what exactly IIS does, when I call a SharePoint site and how URLs are redirected. So I went to the IIS manager and figured, that when I open my website I can see the following folder structure:
_app_bin
_controltemplates
_layouts
_login
_vti_bin
_vti_pvt
...
But when I map a network drive to my SharePoint-root-site, I get a totally different structure (the one what probably comes from the Database)
asf
Cache Profiles
data
DeviceChannels
FormServerTemplates
images
IWConvertedForms
knowledge
...
I would like to understand how this folder structure is created in IIS? Its not a virtual directory, right? Also there is no physical representation on the server HDD of this file tree. Can somebody explain how this works? I only want to get a short overview of what happens, when I navigate to the different SharePoint-URLs.
To summarize my questions:
Question 1: Where is the entry point of a SP-Website? In Apache this was my index.html, but how about SharePoint? There is only the web.config in the root, nothing else.
Question 2: How can the connect to network drive function work, even though I did not enabled any WebDAV service? Which service on the server is responsible for that?
Thanks,
David
I am trying to find a solution to bypass Sign In page of Office 365 SharePoint with Custom sign in page and authenticate for external users.
I tried following code to perform authentication and it works but doesn't redirect to target SharePoint site.
SharePointOnlineCredentials onlineCredentials = new SharePointOnlineCredentials(login, securePassword);
using (ClientContext clientContext = new ClientContext(targetSite))
{
Uri uri = new System.Uri(targetSite);
clientContext.Credentials = onlineCredentials;
Web web = clientContext.Web;
clientContext.Load(web,
webSite => webSite.Title);
clientContext.ExecuteQuery();
string authCookie = onlineCredentials.GetAuthenticationCookie(uri);
CookieContainer cookieContainer = new CookieContainer();
cookieContainer.SetCookies(uri, authCookie);
Response.Redirect(targetSite);
//Console.WriteLine(web.Title);
}
Any help or solution much appreciated.
Hi everybody,
i'am trying to get user properties (UserUrl, PictureUrl) using REST API "GetUserProfilePropertiesFor", but it doesn't work. Please anybody provide a "work"-example! Thanks a lot!
The examples I got from
next page (see 6. Get Multiple UserProfile Properties for Specific User).
I tried also another simple way:
var x = "i:0#.w|sp20130\demo"; jQuery.ajax({ url: _spPageContextInfo.webServerRelativeUrl + "/_api/sp.userprofiles.peoplemanager/getuserprofilepropertyfor(accountame=@v, propertyname='PictureURL')?@v='"+x+"'", type: "GET", headers: { "accept": "application/json;odata=verbose" }, success: function (data) { var result = data.d; console.log(data.d); }, error: function (err) { alert(JSON.stringify(err)); } });
Every time I receive back a error - "Bad request".
At this moment I have only one idea - it is a wrong url (problem with encoding of login name).
#########################
UPDATE! SOLUTION:
var accountName = "sp20130\\demo"; jQuery.ajax({ url: siteUrl + "/_api/SP.UserProfiles.PeopleManager/GetPropertiesFor(accountName=@v)?@v='" + encodeURIComponent(accountName) + "'", method: "GET", headers: { "Accept": "application/json; odata=verbose" }, success: function (data) { console.log(data.d); var pictureUrl = data.d.PictureUrl; var userUrl = data.d.UserUrl; ... }, error: function (data) { console.log(JSON.stringify(data)); } });
Hello All,
i done the Count Attachment's in SPList and storing the count value in separate column. The problem is when in list we cross the 100 itmes , the list page takes more time for loading and list page is getting error .
And my actual list is contains 1000 items .
Below is the code i used ,please check and upadate the code for better page performance.Please help me.
<script type="text/javascript" src="/Style%20Library/jquery-1.12.0.min.js"></script><script type="text/javascript">
$(document).ready(function () {
getListItems();
});
function getListItems()
{
$.ajax({
url: "Https://www.example.com" + "/_api/web/lists/getbytitle('ListName')/items",
method: "GET",
headers: { "Accept": "application/json; odata=verbose" },
success: function (data) {
for (var i = 0; i < data.d.results.length; i++) {
//console.log(data.d.results[i]);
var itemscount = getattachments(data.d.results[i].ID);
console.log(itemscount)
function getItemTypeForListName(name) {
return "SP.Data." + name.charAt(0).toUpperCase() + name.slice(1) + "ListItem";
}
var item = {
"__metadata": { "type": getItemTypeForListName("Listname") },
"AttachmentCount": itemscount
};
$.ajax({
url: data.d.results[i].__metadata.uri,
type: "POST",
contentType: "application/json;odata=verbose",
data: JSON.stringify(item),
headers: {
"Accept": "application/json;odata=verbose",
"X-RequestDigest": $("#__REQUESTDIGEST").val(),
"X-HTTP-Method": "MERGE",
"If-Match": "*"
},
success: function (data) {
console.log("Success");
},
error: function (data) {
console.log("Fail");
}
});
}
},
error: function (data) {
failure(data);
}
});
}
function getattachments(itemid)
{
var url = "https://www.example.com" + "/_api/web/lists/getbytitle('listname')/items(" + itemid + ")/AttachmentFiles";
var itemscount;
$.ajax({
url: url,
headers: {
"Accept": "application/json; odata=verbose"
},
method: "GET",
async: false,
success: onQuerySuccess,
error: onQueryError
});
function onQuerySuccess(data) {
if (data) {
//console.log(data.d.results.length);
var items = data.d.results;
itemscount = data.d.results.length;
for (var i = 0; i < items.length; i++) {
//console.log(items[i].FileName);
}
}
}
function onQueryError(error) {
attCount =0;
alert(error.statusText);
}
return itemscount;}
</script>
Thanks in Advance.
Regards,
Santto