Wednesday, October 31, 2012

Update Date/Time in SharePoint using Object Model

string str = "2012-10-31T00:00:00Z";
DateTime date = DateTime.Parse(str);
DateTime dt1 = date.AddMinutes(15);
string foo = dt1.ToUniversalTime().ToString("yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fff'Z'");

Friday, July 20, 2012

Get Document URL within Folder/Document Set


SPListItem item = ...;
string absUrl = (string) item[SPBuiltInFieldId.EncodedAbsUrl];

Saturday, June 30, 2012

Property Bags in SharePoint 2010

Property Bags enables the developers to add properties to the SharePoint objects like 

a. Farm (SPFarm class)
b. Web application (SPWebApplication class)
c. Site collection (SPSite class)
d. Site (SPWeb class)
e. List (SPList class)

Using Property Bags, developers can avoid storing Key/Value pairs in Web.Config or at some other location. Internally, Property bags are implemented as a hash table of property names and values.

We can set the Property Bag values using two ways:
a. Using SharePoint Designer
b. Programatically

a. Using SharePoint Designer to store Property Bags
(i). Open the site in SP Designer 2010 and click on Site Options.



To read this MyKey value, just use the below code. 

SPSite siteCollection = new SPSite("http://sharepointMoss");
SPWeb website = mySite.RootWeb;
string MyValue = website.AllProperties["MyKey"]);


b. Programatically.

Use the below code to set the property bags Programatically.
SPSite siteCollection = new SPSite("http://sharepointMoss");
SPWeb website = mySite.RootWeb;
website.Properties.Add("MyKey", "MyValue");
website.Properties.Update

CSS for Mozilla and Chrome Specific

To add Mozilla specific CSS, just include the CSS inside @-moz-document url-prefix() as shown below:
/* Mozilla Specific CSS */
 @-moz-document url-prefix()  {
    #imgHeaderTD
    {
        display:none;
    }
}

The above code hides the element with ID imgHeaderTD in Mozilla only.

To add Chrome specific CSS, just include the CSS inside  @media screen and (-webkit-min-device-pixel-ratio:0):


/* Chrome Specific CSS */
@media screen and (-webkit-min-device-pixel-ratio:0) {
    #imgHeaderTD
    {
    display:none;
    }
}

Thursday, June 14, 2012

VS 2005 Web Application Template Add-In

http://download.microsoft.com/download/9/0/6/906064ce-0bd1-4328-af40-49dca1aef87c/WebApplicationProjectSetup.msi

Friday, March 30, 2012

Two-Tier or Three Tier Architecture in SharePoint

If SharePoint Server and the database server are installed on one computer, it is a single-tier deployment.
In a two-tier deployment, SharePoint Server components and the database are installed on separate servers. In a three-tier deployment, the front-end Web servers are on the first tier, the application servers are on the second tier, which is known as the application tier, and the database server is located on the third tier.

Wednesday, February 29, 2012

Css styles not being applied for Anonymous users on sharepoint 2010

I have been stuck with the same problem and dint understand the problem for long enough....
I realized to check in as a major version and the problem solved....

Thanks a lot..

Monday, February 6, 2012

SSL Connection error in chrome 107

Go to option -> proxy settings and the standard MSIE window will pop up. Then go to advanced tab and be sure to tick:
USE SSL 2.0
USE SSL 3.0
USE TSL 1.0

Then click OK, close Chrome, open it again and it shall work.

Monday, January 30, 2012

The settings for this list have been recently changed. Refresh your browser sharepoint 2010

while the FormMode is in Edit mode you cannot call on the Update method for the list. The code works fine in display mode on the DispForm.aspx page and it will hide and show the correct fields in the EditForm.aspx page but when you click Save that is when the error is thrown. If the Update method is removed the error will not be thrown however you will not be able to see the changes to the fields.

Check list.update() method and if it is unnecessary then remove it.