http://www.sharepointpals.com/post/Step-by-Step-Procedure-to-Call-SharePoint-Office-365-REST-API-from-Microsoft-Flow
Wednesday, 28 March 2018
Monday, 11 December 2017
To Get Internal Name of List Column (Column Name in Content DB)
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml;
namespace ConsoleApplication4
{
class Program
{
static void Main(string[] args)
{
XmlDocument doc = new XmlDocument();
doc.Load("D:\\Test\\manifest.xml");
//Display all the book titles.
XmlNodeList elemList = doc.GetElementsByTagName("Field");
string[] a = new string[elemList.Count];
for (int i = 0; i < elemList.Count; i++)
{
if (elemList[i].Attributes["DisplayName"] != null && elemList[i].Attributes["ColName"] != null)
{
string DisplayName = elemList[i].Attributes["DisplayName"].Value.ToString();
string ColName = elemList[i].Attributes["ColName"].Value;
a[i] = ColName + " : " + DisplayName;
}
}
System.IO.File.WriteAllLines("D:\\Test\\manifest.txt", a);
}
}
}
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml;
namespace ConsoleApplication4
{
class Program
{
static void Main(string[] args)
{
XmlDocument doc = new XmlDocument();
doc.Load("D:\\Test\\manifest.xml");
//Display all the book titles.
XmlNodeList elemList = doc.GetElementsByTagName("Field");
string[] a = new string[elemList.Count];
for (int i = 0; i < elemList.Count; i++)
{
if (elemList[i].Attributes["DisplayName"] != null && elemList[i].Attributes["ColName"] != null)
{
string DisplayName = elemList[i].Attributes["DisplayName"].Value.ToString();
string ColName = elemList[i].Attributes["ColName"].Value;
a[i] = ColName + " : " + DisplayName;
}
}
System.IO.File.WriteAllLines("D:\\Test\\manifest.txt", a);
}
}
}
Wednesday, 24 May 2017
User Profile, Search, BCS, My Site
Tuesday, 9 May 2017
Multi Query String Script
<script src="../sites/salaryrecord/SiteAssets/jquery-2.1.4.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function ()
{
var aIDValue = getQueryStringParameter("aID");
var RMIDValue = getQueryStringParameter("RMID");
var loc = window.top.location.href;
var arrFrames = document.getElementsByTagName("iframe");
if(aIDValue == undefined){
for(i = 0; i< arrFrames.length; i++)
{
var iFrame=arrFrames[i];
var clientID2 = "CustomPropertyValue2";
if(iFrame.src.indexOf(clientID2) != -1)
{
iFrame.src=iFrame.src.replace(clientID2,loc);
}
}
}
if(RMIDValue == undefined){
for(i = 0; i< arrFrames.length; i++)
{
var iFrame=arrFrames[i];
var clientID1 = "CustomPropertyValue1";
if(iFrame.src.indexOf(clientID1) != -1)
{
iFrame.src=iFrame.src.replace(clientID1,loc);
}
}
}
});
function getQueryStringParameter(paramToRetrieve) {
var params;
var strParams;
params = document.URL.split("?")[1].split("&");
strParams = "";
for (var i = 0; i < params.length; i = i + 1) {
var singleParam = params[i].split("=");
if (singleParam[0] == paramToRetrieve)
return singleParam[1];
}
}
</script>
Thursday, 16 March 2017
Wednesday, 15 March 2017
Read Excel File as a Data Table using OLEDB
string filepath = string.Empty;
filepath = "C:\\TEST.xlsx";
string sSourceConstr = @"Provider=Microsoft.ACE.OLEDB.12.0; Data Source= " + filepath + "; Extended Properties=Excel 8.0";
OleDbConnection sSourceConnection = new OleDbConnection(sSourceConstr);
//OleDbCommand cmd = new OleDbCommand("SELECT * FROM [CQALRPF$] WHERE [FACNO] =@id", sSourceConnection);
OleDbCommand cmd = new OleDbCommand("SELECT * FROM [Sheet1$]", sSourceConnection);
//cmd.Parameters.AddWithValue("@id", 523001740206);
OleDbDataAdapter oleda = new OleDbDataAdapter();
oleda.SelectCommand = cmd;
DataSet ds = new DataSet();
oleda.Fill(ds);
DataTable dt = ds.Tables[0];
//To Extract Datable to Excel File [xls Format]
StreamWriter wr = new StreamWriter(@"C:\Users\shareadmin\Desktop\On-Process\\Test_OnProcess.xls");
try
{
for (int i = 0; i < dt.Columns.Count; i++)
{
wr.Write(dt.Columns[i].ToString().ToUpper() + "\t");
}
wr.WriteLine();
//write rows to excel file
for (int i = 0; i < (dt.Rows.Count); i++)
{
for (int j = 0; j < dt.Columns.Count; j++)
{
if (dt.Rows[i][j] != null)
{
wr.Write(Convert.ToString(dt.Rows[i][j]) + "\t");
}
else
{
wr.Write("\t");
}
}
//go to next line
wr.WriteLine();
}
//close file
wr.Close();
}
catch (Exception ex)
{
throw ex;
}
try
{
for (int i = 0; i < dt.Columns.Count; i++)
{
wr.Write(dt.Columns[i].ToString().ToUpper() + "\t");
}
wr.WriteLine();
//write rows to excel file
for (int i = 0; i < (dt.Rows.Count); i++)
{
for (int j = 0; j < dt.Columns.Count; j++)
{
if (dt.Rows[i][j] != null)
{
wr.Write(Convert.ToString(dt.Rows[i][j]) + "\t");
}
else
{
wr.Write("\t");
}
}
//go to next line
wr.WriteLine();
}
//close file
wr.Close();
}
catch (Exception ex)
{
throw ex;
}
Subscribe to:
Posts (Atom)