Tuesday, March 5, 2013

Activating Napa App for Office Online SharePoint 2013 Development



So you are all set and got the free app called NAPA but it's keep on showing you with the message that you can not add this app here.So what's going wroing????

So here is what you should do.

Just add the “Napa” Office 365 Development Tools app to your SharePoint Online Developer Site, launch it, and you will be ready to create your first app for Office or SharePoint.

To enable Napa for App Development, please follow below steps

• In your Office 365 Admin Panel, choose SharePoint

• Create a Private Site Collection with Developer Site template.

• Browse to the newly create Site Collection and then select on first tile “Build an App”

• Now Click on ADD IT and Trust it and you are good to go.

Cheers!!! Suneet

Friday, February 22, 2013

Merge multiple documents in SharePoint 2010 Programmatically

So here is the scenario:

 
1.  SharePoint document library has multiple documents with the same context let’s say month’s announcements.

2.  Now a single newsletter should go to all users with all announcements in a single announcement monthly letter.

3.  So it’s nothing but merging multiple documents into a single document.

 

Note:
Here “filepath1” is the location of the first document and “filepath2” is for second document. So it could be like http:/// Lib>/documentname.docx

Hope you are clear here as this code only merge 2 documents…but with a loop you can have multiple documents.


________________________________________________________________________________
private void readDocument(string filePath1, string filePath2)

        {
            string targetfile = string.Empty;
            object file1 = filePath1;
            object file2 = filePath2;
            object file3 = targetfile;
            object objMissing = System.Reflection.Missing.Value;
            object objTrue = System.Reflection.Missing.Value;
            object start = 0;
            object end = 0;

          

ApplicationClass WordApp = new Microsoft.Office.Interop.Word.ApplicationClass();


Document finalDocument = WordApp.Documents.Add(ref objMissing, ref objMissing, ref objMissing, ref objMissing);
 

//Range field will ensure they won’t overwrite and second document start where first document ends.


Range rng = finalDocument.Range(ref start, ref objMissing);

rng.InsertFile(filePath1, ref objMissing, ref objMissing, ref objMissing, ref objMissing);

start = (WordApp.ActiveDocument.Content.End)-1; 

Range rng1 = finalDocument.Range(ref start, ref objMissing); 

rng1.InsertFile(filePath2, ref objMissing, ref objMissing, ref objMissing, ref objMissing); 

start = (WordApp.ActiveDocument.Content.End) - 1; 

finalDocument.Save();         

}

 

Cheers!!!

Suneet