#CAML Query
Explore tagged Tumblr posts
sharepointsaketa · 5 years ago
Link
CAML Queries, Metadata bulk edit, Powershell scripting, Security manager, Turbo mode.
Tumblr media
Seamlessly Migrate to SharePoint with Saketa SharePoint migrator, Pre & Post Migration, CAML Queries, Metadata bulk edit, Powershell scripting, Security manager, Turbo mode.
0 notes
mobileappsdevelopment · 6 years ago
Text
What are the best app development tools for Sharepoint?
In today’s world, it’s all regarding speed and accuracy and SharePoint development isn't any totally different during this. to assist the SharePoint developer community an outsized range of tools and utilities have return up and evolved into what we have a tendency to decision ‘must-have tools’ for a SharePoint developer. we have a tendency to performed varied internal searches among our development team and variety of such powerful tools were listed out. when a careful analysis and consideration on the deserves of victimization tools here area unit the highest six listed:
1. SharePoint Search query tool
2. SharePoint Manager 2013
3. CAML query builder
4. ULS Viewer
5. Fiddler
6. CKS Dev
1. SharePoint Search Query Tool
Searching and looking for the relevant data is that the most vital for each project. SharePoint isn't any totally different in building and sharing data in large volume. For building this economical search, it's perpetually difficult to jot down queries for the developers. this can be long and might even result in undesirable results. This tool comes with a predefined set of question choices. The developers will build still because of the queries and their leads to the required format between JSON and XML, on the go whereas performing on immense SharePoint farm. Therefore, these tools modify your search needs.
2. SharePoint Manager 2013
Exploring SharePoint Object Model of the project is a clear task whereas performing on any resolution. This tool helps in seeing the SharePoint farm structure. This helps in visualizing the schema hold on within the information. The users with server access will solely use this tool, which may be wont to see the whole object structure and underline properties and their values.
Also Read: a way to Optimize Your Sharepoint application development?
3. CAML Query Builder
There is no custom development project in SharePoint that doesn't involve actuation knowledge from SharePoint list and libraries. this may be finished the assistance of CAML queries. a big a part of the event effort goes in writing and optimizing the CAML Queries. an efficient CAML question builder tool, together with saving your development time may validate your results as you're writing the queries.
4. ULS Viewer
While performing on comes SharePoint log files have a large range of logs on every request. Therefore, it becomes arduous to spot and right the matter manually. ULS Viewer helps to perform this job in an exceedingly} very short time. It provides multiple filters to refine the logs and find the required lines of a statement supported correlation id and levels. Summing up, if you're configuring, deploying or debugging the SharePoint project, then the ULS Log Viewer helps to look the logs instantly and so saves the time in partitioning the errors.
Also Read: Sharepoint Is rattling than You Ever Thought!
5. Fiddler
Debugging the shopper-facet interface for all the requests and responses could be a long method for a developer. looking for the assorted net sessions, their responses traffic etc area unit terribly tedious tasks. With Fiddler, you'll simply analyze the statistics of the request and downloaded knowledge that helps US in rising the performance of the web site. The request traffic may be recorded for more use. Therefore, if you're trying to find a tool for fast debugging and client-side testing you'll use Fiddler.
6. CKS Dev
This could be a plugin for Visual Studio that is a killer feature that you just will later while not. This has been engineered by a team of awful of us within the community as associate degree extension to Visual Studio and currently, it's support for 2013 still. It permits you to manage your development routines a lot of with efficiency whereas you're on the committal to writing the journey. It conjointly adds a bunch of recent projects things for your SharePoint comes associate degreed it contributes to an overall satisfactory SharePoint development story.
Also Read: Things to contemplate whereas designing your SharePoint computer network
The preceding area unit the six must-have SharePoint development tools we might wish to mention. we have a tendency to area unit happy to share our expertise in having used these tools, which may facilitate the in increasing our potency. although their area unit several tools offered on the market we might like these tools to be used extensively that area unit a section of our comes and success stories. you'll refer and suggest a lot of tools you're victimization and in what varied ways in which they're tributary. Let’s share this and find the most advantage to make the SharePoint development team a lot of economical and productive.
Rajasri systems may be a SharePoint development company that provides a large vary of SharePoint services to supply our international shoppers with user-friendly, feature-rich SharePoint applications investment Microsoft SharePoint functionalities.
Let's connect wih us : rajasri.com
0 notes
softreetechnology-blog · 6 years ago
Text
Identify The Modern Pages And Copy Them To Another Site Collection
In this blog, I am going to perform two actions -
Identify if a page is a modern page or not.
Migrate or copy that modern page (including its content) to another site collection or site (destination location)
I am going to accomplish these tasks by using CSOM (Client Object Model). After identifying the modern page, I will copy the modern page into another site collection (destination location) and then, will migrate all the page contents of this modern page (including web parts and other properties of source modern page) to a destination web using CSOM. We are using a console application to achieve the above functionality using CSOM. In the below-mentioned code logic, we will get all pages from ‘Site Pages’ page library which is present in the source web and looping each page to check if that is a modern page or not. If the page is found to be a modern page, then we are migrating that page to the destination web ‘Site Pages’ library. Please have a look at the below code. The code is self-explanatory because of the comments.
using System;
using System.Net;
using System.Security;
using System.Text.RegularExpressions;
using Microsoft.SharePoint.Client;
namespace ConsoleApp1 {
class Program {
static void Main(string[] args) {
ClientContext sourceContext = null;
List sourceList = null;
ListItemCollection srcItemCollection = null;
ListItem sourceItem = null;
string userName = string.Empty;
string password = string.Empty;
SecureString srcSiteSecurePassword = new SecureString();
SharePointOnlineCredentials sourceOnlineCredentials = null;
try {
using(sourceContext = new ClientContext("http://sourcesiteurl")) {
userName = "TestUser";
password = "Password";
if (!string.IsNullOrEmpty(password)) {
foreach(char c in password.ToCharArray())
srcSiteSecurePassword.AppendChar(c);
}
// Setting credential for the above site
sourceOnlineCredentials = new SharePointOnlineCredentials(userName, srcSiteSecurePassword);
sourceContext.Credentials = sourceOnlineCredentials;
sourceContext.Load(sourceContext.Web);
sourceContext.ExecuteQuery();
// Getting source list by Title
sourceList = sourceContext.Web.Lists.GetByTitle("Site Pages");
// Getting all items from source list using caml query
srcItemCollection = sourceList.GetItems(CamlQuery.CreateAllItemsQuery());
//Loading source items
sourceContext.Load(srcItemCollection, IC => IC.Include(I => I.Id, I => I.DisplayName));
sourceContext.ExecuteQuery();
if (srcItemCollection != null && srcItemCollection.Count > 0) {
for (int iCount = 0; iCount < srcItemCollection.Count; iCount++) {
try {
sourceItem = srcItemCollection[iCount];
//Checking if current page is modern page or not
if (IsModernPage(sourceContext, sourceItem)) {
// Migrate modern page to anothen site
MigrateModernPageToAnotherWeb(sourceContext, sourceItem);
}
} catch (Exception ex) {}
}
}
}
} catch (Exception ex) {}
}
// Checking if the selected page is a modern page or not
private static bool IsModernPage(ClientContext sourceContext, ListItem sourceItem) {
bool isModernPage = false;
try {
sourceContext.Load(sourceItem, srcItm => srcItm["CanvasContent1"], srcItm => srcItm["LayoutWebpartsContent"]);
sourceContext.ExecuteQuery();
// Check if modern page
if (!string.IsNullOrEmpty(sourceItem["CanvasContent1"].ToString()) || !string.IsNullOrEmpty(sourceItem["LayoutWebpartsContent"].ToString())) isModernPage = true;
} catch {
isModernPage = false;
}
return isModernPage;
}
// Migrating the modern page from source site to destination site
private static void MigrateModernPageToAnotherWeb(ClientContext sourceContext, ListItem sourceItem) {
ClientContext destSiteContext = null;
List destList = null;
ListItem destItem = null;
string userName = string.Empty;
string password = string.Empty;
SecureString destSiteSecurePassword = new SecureString();
SharePointOnlineCredentials destOnlineCredentials = null;
string canvasContent = string.Empty;
string metaInfo = string.Empty;
string layoutWebpartsContent = string.Empty;
try {
using(destSiteContext = new ClientContext("http://destinationsiteurl")) {
userName = "TestUser";
password = "Password";
if (!string.IsNullOrEmpty(password)) {
foreach(char c in password.ToCharArray())
destSiteSecurePassword.AppendChar(c);
}
// Setting credential for the above site
destOnlineCredentials = new SharePointOnlineCredentials(userName, destSiteSecurePassword);
destSiteContext.Credentials = destOnlineCredentials;
destSiteContext.Load(destSiteContext.Web);
destSiteContext.ExecuteQuery();
// Getting destination list by Title
destList = destSiteContext.Web.Lists.GetByTitle("Site Pages");
// Loading destination list
destSiteContext.Load(destList, L => L.RootFolder.ServerRelativeUrl);
destSiteContext.ExecuteQuery();
// Creating modern page in destination site
destItem = destList.RootFolder.Files.AddTemplateFile(destList.RootFolder.ServerRelativeUrl.TrimEnd('/') + "/" + sourceItem.DisplayName + ".aspx", TemplateFileType.ClientSidePage).ListItemAllFields;
destSiteContext.Load(destItem);
destSiteContext.ExecuteQuery();
// Loading source item properties
sourceContext.Load(sourceItem, i => i.ContentType.Id, i => i["CanvasContent1"], i => i["MetaInfo"], i => i["LayoutWebpartsContent"]);
sourceContext.ExecuteQuery();
try {
destItem["ContentTypeId"] = sourceItem.ContentType.Id.ToString();
canvasContent = sourceItem["CanvasContent1"].ToString();
// Replacing source Web ID with destination Web ID
if (!string.IsNullOrEmpty(canvasContent) && canvasContent.Length > 0 && canvasContent.ToLower().Contains(sourceContext.Web.Id.ToString().ToLower())) canvasContent = Regex.Replace(canvasContent, sourceContext.Web.Id.ToString(), destSiteContext.Web.Id.ToString(), RegexOptions.IgnoreCase);
} catch (Exception ex) {}
try {
metaInfo = sourceItem["MetaInfo"].ToString();
// Replacing source Web ID with destination Web ID
if (!string.IsNullOrEmpty(metaInfo) && metaInfo.Length > 0 && metaInfo.ToLower().Contains(sourceContext.Web.Id.ToString().ToLower())) metaInfo = Regex.Replace(metaInfo, sourceContext.Web.Id.ToString(), destSiteContext.Web.Id.ToString(), RegexOptions.IgnoreCase);
} catch (Exception ex) {}
try {
layoutWebpartsContent = sourceItem["LayoutWebpartsContent"].ToString();
// Replacing source Web ID with destination Web ID
if (!string.IsNullOrEmpty(layoutWebpartsContent) && layoutWebpartsContent.Length > 0 && layoutWebpartsContent.ToLower().Contains(sourceContext.Web.Id.ToString().ToLower())) layoutWebpartsContent = Regex.Replace(layoutWebpartsContent, sourceContext.Web.Id.ToString(), destSiteContext.Web.Id.ToString(), RegexOptions.IgnoreCase);
} catch (Exception ex) {}
// Setting source page canvas content to destination page
if (!string.IsNullOrEmpty(canvasContent) && canvasContent.Length > 0) destItem["CanvasContent1"] = canvasContent;
// Setting source page metaInfo content to destination page
if (!string.IsNullOrEmpty(metaInfo) && metaInfo.Length > 0) destItem["MetaInfo"] = metaInfo;
// Setting source page layout webparts content to destination page
if (!string.IsNullOrEmpty(layoutWebpartsContent) && layoutWebpartsContent.Length > 0) destItem["LayoutWebpartsContent"] = layoutWebpartsContent;
// Updating the destination page
destItem.Update();
destSiteContext.ExecuteQuery();
}
} catch (Exception ex) {}
}
}
}
Destination Page Library Before Migration: –
Tumblr media
Destination Page Library after Migration:-
Tumblr media
After executing the above code behind, you can find the newly created modern page in the destination web ‘Site Pages’ library with the same page contents and “web parts” as they were in the source page.
This solution is brought to you by our SharePoint professionals.
Softree Consulting employs SharePoint consultants; we are a technology services provider with the aim to help companies achieve exceptional performance through SharePoint. Our dedicated team of SharePoint consultants has the right bent of mind to understand and execute customer requirements.
Be it SPFx or SharePoint add-in developments, SharePoint 2019 developments, web part developments, migrating from SharePoint 2010/2013 to SharePoint 2013/2016/Office 365, Office 365, SharePoint hosted apps development or something else in SharePoint, we strive to deliver the best
0 notes
carlajsmith · 7 years ago
Text
Console Application To Fetch SharePoint List Data Using REST API With CAML Query In C# Managed Code
SharePoint 2013 has many restful APIs, to fetch data from lists. However, sometimes we need to use CAML query to filter out the data. SharePoint rest API has an option to pass CAML query as a data to API call. Below steps will help you to call a rest API with CAML query filtering. from C-Sharpcorner Latest Content https://ift.tt/2EnCxB0
from C Sharp Corner https://csharpcorner.tumblr.com/post/172635223521
0 notes
csharpcorner · 7 years ago
Text
Console Application To Fetch SharePoint List Data Using REST API With CAML Query In C# Managed Code
SharePoint 2013 has many restful APIs, to fetch data from lists. However, sometimes we need to use CAML query to filter out the data. SharePoint rest API has an option to pass CAML query as a data to API call. Below steps will help you to call a rest API with CAML query filtering. from C-Sharpcorner Latest Content https://ift.tt/2EnCxB0
0 notes
alanlcole · 7 years ago
Text
Console Application To Fetch SharePoint List Data Using Rest API With CAML Query
SharePoint 2013 has many restful APIs, to fetch data from lists. However, sometimes we need to use CAML to filter out the data. source https://www.c-sharpcorner.com/article/console-application-to-fetch-sharepoint-list-data-using-rest-api-with-caml-query/ from C Sharp Corner https://ift.tt/2JlL4Z4
0 notes
jquintozamora · 8 years ago
Text
Update Page Layout by using JavaScript (JSOM) in Office 365
Update Page Layout by using JavaScript (JSOM) in Office 365
  Hi,
I’m going to show how to update or change the page layout for a given SharePoint page. That sounds quite straightforward, but we have to mind some important bits:
– Check in, check out status of the current page or item we are changing.
– CAML query using Page Layout as a FieldRef filter
– Use SP.FieldUrlValue to update the Page Layout property.
I’d like to share the JSOM (JavaScript) code…
View On WordPress
0 notes
phorlaville · 12 years ago
Text
List of lists - Sharepoint 2013
Bon. La problématique : Lister sur la home page d'un site sharepoint 2013 la liste des listes de type "Survey", avec un lien vers ces listes.
Après avoir farfouillé du côté des webpart sans succès j'ai décidé de faire ça avec le designer..
Le datasource : <SharePointWebControls:SPDataSource     ID="SPDataSource1"     runat="server"     DataSourceMode="Listoflists"> </SharePointWebControls:SPDataSource>
Rien de bien sorcier... http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.webcontrols.spdatasource.datasourcemode.aspx http://solutionizing.net/spdatasource-fields-for-webs-listsoflists/
La grid :
<asp:GridView     ID="GridView1"     runat="server"     DataSourceID="SPDataSource1"     AutoGenerateColumns="False" AllowSorting="True" AllowPaging="True" PageSize="2000" CellPadding="3" BorderStyle="Solid" BorderWidth="1px" HorizontalAlign="Left" EnableSortingAndPagingCallbacks="True">     <Columns>         <asp:boundfield DataField="__spBaseTemplate" HeaderText="Survey Type">         </asp:boundfield>         <asp:hyperlinkfield DataNavigateUrlFields="__spDefaultViewUrl" DataTextField="__spTitle" HeaderText="Survey Name">         </asp:hyperlinkfield>         <asp:boundfield DataField="__spCreated" HeaderText="Survey Date">         </asp:boundfield>         <asp:boundfield DataField="__spAuthor" HeaderText="Survey Author">         </asp:boundfield>     </Columns> </asp:GridView>
Ça donne ça :
Tumblr media
Le problème : pour filtrer et ordonner les spdatasources, on se sert généralement d'une CAML Query.
Je recommande vivement ce petit outil : CAML Designer
ça devrait donner ça pour le SPDatasource :
<SharePoint:SPDataSource     ID="SPDataSource1"     runat="server"     DataSourceMode="Listoflists"     SelectCommand="<View><ViewFields><FieldRef Name='__spTitle'/><FieldRef Name='__spCreated'/><FieldRef Name='__spBaseTemplate'/><FieldRef Name='__spDefaultViewUrl'/></ViewFields><Query><OrderBy><FieldRef Name='Created' /></OrderBy><Where><Eq><FieldRef Name='__spBaseTemplate' /><Value Type='Text'>Survey</Value></Eq></Where></Query></View>"> </SharePoint:SPDataSource>
Et bien non.... le selectcommand n'est absolument pas pris en compte pour le mode Listoflist...
Résultat : j'obtiens bien une liste de mes listes. De toutes mes listes, non filtrées et non triées par date de création...
Pour le filtrage sur le type "Survey", je fais ça en jQuery : je masque la ligne (TR) si le contenu de la 1ere colonne est "Survey", après avoir créé un div avec id pour englober ma grid. J'en profite pour mettre un peu en forme et masquer la 1ere colonne (type de liste) :
<SharePointWebControls:SPDataSource     ID="SPDataSource1"     runat="server"     DataSourceMode="Listoflists" UseServerDataFormat="True"> </SharePointWebControls:SPDataSource> <div id="surveylist" style="display:none;"> <asp:GridView     ID="GridView1"     runat="server"     DataSourceID="SPDataSource1"     AutoGenerateColumns="False" AllowSorting="True" AllowPaging="True" PageSize="2000" CellPadding="3" BorderStyle="Solid" BorderWidth="1px" HorizontalAlign="Left" EnableSortingAndPagingCallbacks="True">     <Columns>         <asp:boundfield DataField="__spBaseTemplate" HeaderText="Survey Type">         </asp:boundfield>         <asp:hyperlinkfield DataNavigateUrlFields="__spDefaultViewUrl" DataTextField="__spTitle" HeaderText="Survey Name">         </asp:hyperlinkfield>         <asp:boundfield DataField="__spCreated" HeaderText="Survey Date">         </asp:boundfield>         <asp:boundfield DataField="__spAuthor" HeaderText="Survey Author">         </asp:boundfield>     </Columns> </asp:GridView> </div> <script type="text/javascript"> $(document).ready(function() {   $("tr th:first-child").hide();   $("tr td:first-child").hide();   $("tr td:first-child:not(:contains('Survey'))").closest('tr').hide();   $("#surveylist th").css('text-align','left');   $("#surveylist").show(); }); </script>
Ça donne ça :
Tumblr media
Si jamais quelqu'un a une solution plus "propre", je suis preneur :)
0 notes
softreetechnology-blog · 6 years ago
Text
How to get all SharePoint List item versions using 'Client Side Object' model both for Custom list and Document Library?
Basically, in CSOM, there is no direct property to get the item versions from a List Item. But by using "Lists Web Service"(/_vti_bin/Lists.asmx) we can get all versions and properties information for each item inside Custom List or Document Library.
To get the above-required functionality, first of all, we have added the "Lists Web Service" in the required project.
In this blog, I am going share all codes how we can get all List Items version by using "Lists Web Service". We all know how to add a service inside a project.
I am using a simple Console application to iterate all item versions information. Please follow the below code...
using System; using System.Net; using System.Xml;
using Microsoft.SharePoint.Client;
namespace ConsoleApp1 {    class Program    {        static void Main(string[] args)        {            ClientContext context = null;            List list = null;            ListItemCollection itemCollection = null;            ListItem item = null;
           string userName = string.Empty;            string password = string.Empty;            string dateHistory = string.Empty;            string commentHistory = string.Empty;            string editor = string.Empty;            string loginName = string.Empty;
           try            {                using (context = new ClientContext("http://SourceWebUrl"))                {                    userName = "UserName";                    password = "PassWord";                    
                   // Setting credential for the above site                                        context.Credentials = new NetworkCredential(userName, password);                    context.Load(context.Web);                    context.ExecuteQuery();
                   // Getting list by Title                    list = context.Web.Lists.GetByTitle("Custom List");                    context.Load(list, L => L.Id);
                   // Getting all items from selected list using caml query                    itemCollection = list.GetItems(CamlQuery.CreateAllItemsQuery());
                   //Loading selected list items                    context.Load(itemCollection, IC => IC.Include(I => I.Id, I => I.DisplayName));                    context.ExecuteQuery();
                   if (itemCollection != null && itemCollection.Count > 0)                    {                        for (int iCount = 0; iCount < itemCollection.Count; iCount++)                        {                            try                            {                                item = itemCollection[iCount];
                               ListService.Lists listService = new ListService.Lists();                                listService.Url = context.Url + "/_vti_bin/Lists.asmx";                                listService.Credentials = context.Credentials;
                               //Getting all item versions from custon list item using List Web Service                                XmlNode nodeVersions = listService.GetVersionCollection(list.Id.ToString(), item.Id.ToString(), "_UIVersionString");
                               //looping all versions and getting 'Modified' and 'Editor' property of each version                                foreach (XmlNode xNode in nodeVersions)                                {                                    try                                    {                                                                              dateHistory = xNode.Attributes["Modified"].Value;                                        dateHistory = FormatDateFromSP(dateHistory);                                        commentHistory = xNode.Attributes["_UIVersionString"].Value;                                        loginName = xNode.Attributes["Editor"].Value;                                                                            }                                    catch { }                                }                            }                            catch (Exception ex) { }                        }                    }                }            }            catch (Exception ex) { }        }
       private static string FormatDateFromSP(string dateHistory)        {            string result;
           result = dateHistory.Replace("T", " ");            result = result.Replace("Z", "");
           return result;        }            } }
This solution is brought to you by our SharePoint professionals.
Softree Consulting employs SharePoint consultants; we are a technology services provider with the aim to help companies achieve exceptional performance through SharePoint. Our dedicated team of SharePoint consultants has the right bent of mind to understand and execute customer requirements.
Be it SPFx or SharePoint add-in developments, SharePoint 2019 developments, web part developments, migrating from SharePoint 2010/2013 to SharePoint 2013/2016/Office 365, Office 365, SharePoint hosted apps development or something else in SharePoint, we strive to deliver the best
0 notes
csharpcorner · 7 years ago
Text
Console Application To Fetch SharePoint List Data Using Rest API With CAML Query
SharePoint 2013 has many restful APIs, to fetch data from lists. However, sometimes we need to use CAML to filter out the data. from C-Sharpcorner Latest Content https://ift.tt/2GxkUob
0 notes
csharpcorner · 7 years ago
Text
Group By Using Rest API
The Rest-API does not support groupby functionality but we can achieve this by using CAML query in Rest-API call. from C-Sharpcorner Latest Content http://ift.tt/2EzCfZA
0 notes