Thursday, December 15, 2011

SharePoint CAML query to search folder

I am posting here SharePoint CAML query to search a folder by name. The thing to be notice here is that name field is neither "Title" nor "Name" as we might guess but "NameOrTitle".

            string caml = "<Where>" +
                                "<And>" +
                                    "<Eq>" +
                                        "<FieldRef Name='NameOrTitle'/>" +
                                        "<Value Type='Text'>" + FolderId + "</Value>" +
                                    "<Eq>" +
                                        "<FieldRef Name='ContentType' />" + 
                                        "<Value Type='Text'>Folder</Value>" +
                                    "</Eq>" +
                                "</And>" + 
            SPQuery qry = new SPQuery();
            qry.Query = caml;
            SPListItemCollection items = PicLib.GetItems(qry);


Monday, November 28, 2011

"The breakpoint will not currently be hit" and "SharePoint 2010 Event Not Firing"

Today I faced strange problem while moving my Visual Studio 2010 solution to different folder.
After moving the project I tried to run in debug mode and I had two problems:
1. Breakpoint: I got message in VS that "The breakpoint will not currently be hit. No symbols have been loaded for this document"

2. The event was not firing.

I google for the Breakpoint error and tried many solution.
I have even tried reinstalling Visual Studio 2010.

When I got tired I decided to do it my own.
I look around and found that the feature's  "ItemAdded" property was set to "False", I trued that to "True" and I thought I would work and it worked.

I still have the breakpoint problem but the code was breaking fine and event was firing too :)

I spent whole day so posting here not you.

Sunday, November 27, 2011

Office 365 SharePoint Online, Error in IE browser "Cookies must be allowed"

Recently I faced a starnge issue while opening my Office 365 SharePoint Online site in IE browser:
"Cookies must be allowed".

Let me first tell the issue was due to adding in my trusted site list.
Solution : Just remove the site from "Trusted Sites" list and you are done :)

Please note that you will notice different error at first and once you clean cookies, history etc this error will come up.
I have spent about a whole day in struggling with that. I tried remove IE 9 and back to IE 8, thought it was IE 9 problem.
Tried disk cleanup using third party tool also.

Hope this will help someone searching for the solution.