Tuesday, July 15, 2014

SharePoint 2013 following links could be useful

1)http://blogs.msdn.com/b/amigan/archive/2012/12/10/part-1-why-apps-are-needed-for-sharepoint-2013.aspx

2)http://blogs.msdn.com/b/amigan/archive/2012/12/10/part-2-introduction-to-sharepoint-2013-app-model.aspx

3) https://www.youtube.com/watch?v=xHkGDJmHxYo

4)http://sharepoint.stackexchange.com/questions/54008/how-to-create-apps-for-sharepoint-2013-in-visual-studio-2012

5) http://www.sharepoint-journey.com/

6)http://www.slideshare.net/bramdejager/developing-sharepoint-2013-apps-with-visual-studio-2012-sharepoint-connections-amsterdam-2013-bram-de-jager

7)http://sharepoint-community.net/profiles/blogs/sharepoint-2013-sharepoint-hosted-app-development-colorcalendar

Monday, July 14, 2014

serialize object to JSON format in ASP.NET

1) public static Company GetData()
{
    return new Company()
    {
        Title = "Company Ltd",
        Employees = new List<Employee>()
            {
                new Employee(){ Name = "Mark CEO", EmployeeType = EmployeeType.CEO },
                new Employee(){ Name = "Matija Božičević", EmployeeType = EmployeeType.Developer },
                new Employee(){ Name = "Steve Developer", EmployeeType = EmployeeType.Developer}
            }
    };
}


JavaScriptSerializer().Serialize

// Load object with some sample data
Company company = GetData();
 
// Pass "company" object for conversion object to JSON string
string json = new System.Web.Script.Serialization.JavaScriptSerializer().Serialize(company);
 
// Write that JSON to txt file
File.WriteAllText(Environment.CurrentDirectory + @"\JSON.txt", json);


The content of that "JSON.txt" file is following:

{"Title":"Company Ltd","Employees":[{"Name":"Mark CEO","EmployeeType":0},{"Name":"Matija
Božičević","EmployeeType":1},{"Name":"Steve Developer","EmployeeType":1}]}


JavaScriptSerializer().Deserialize


string json = File.ReadAllText(Environment.CurrentDirectory + @"\JSON.txt");
             
Company company = new System.Web.Script.Serialization.JavaScriptSerializer().Deserialize<Company>(json);