Thursday, September 15, 2011

SharePoint Foundation + edit/update excel files programatically in Document library

Voila.....finally its working.....:-)

After googling for hours together finally found the appropriate codes/links

my requirement is quite simple (???)

update/edit the excel files in my document library programatically. Sounds simple.....huh?

The real problems occur when we start working towards the requirement.

problem 1.   Server will not have excel dlls to work with.
problem 2.  Jet/ACE drivers giving lot of error while using  (using OLEDB)
Problem 3. Cannot trust third party dlls

Finally microsoft/other sites shed some light on how to use Open XML for this scenario.

http://howtosharepoint.blogspot.com/2010/05/programmatically-edit-and-save-file.html

http://msdn.microsoft.com/en-us/library/ee956524.aspx


I've created one class with the methods given in Open XML.

Created one method as below

public static MemoryStream UpdateMe2(MemoryStream memStr, string sheetName, string strCellName, string strVal)
       {

           using (SpreadsheetDocument document = SpreadsheetDocument.Open(memStr, true))
           {
               WorkbookPart wbPart = document.WorkbookPart;

               UpdateValue(wbPart, sheetName, strCellName, strVal, 0, true);
               return memStr;
           }

           return null;
       }




Tuesday, September 13, 2011

SharePoint Timer jobs Access denied on feature activation

Thanks to Kshitijb  @
http://social.msdn.microsoft.com/Forums/en-US/sharepoint2010general/thread/f41810ec-2348-436d-a574-c29656f3a567/

Refer this link for detailed explanation.
http://stackoverflow.com/questions/1036589/problem-in-creating-timer-job


The problem is , my feature has scope site.

Timerjob's feature Scope should be web application or Farm.

It solved my problem.

BUT I do remember, I have some timer jobs with scope web and are running fine. (This is NOT recommended)


SharePoint Webpart Page with quick launch

With SharePoint 2007 all you needed to do was edit the page in SharePoint Designer and remove the following 2 lines:

< asp:Content ContentPlaceHolderId="PlaceHolderNavSpacer" runat="server">
< asp:Content ContentPlaceHolderId="PlaceHolderLeftNavBar" runat="server">

With SharePoint 2010 you also need to delete the following:

< style type="text/css">
body #s4-leftpanel {
display:none;
}
.s4-ca {
margin-left:0px;
}



Thanks To the author @

http://pscave.blogspot.com/2010/10/show-quick-launch-on-sharepoint-2010.html