Hi,
You will have to get the instances of users who are in your site in some situations. Then make sure that you are using the proper property to get the details.
SPWeb.Users returns the users that are added to that particular subsite only. It will not list the users inherited form parent site.
SPWeb.SiteUsers returns all the users.
Same with SPWeb.Groups and SPWeb.SiteGroups.
This blog is a repository of my experiences and knowledge in SharePoint Development and Management.
Friday, July 23, 2010
Run with elevated privilages............
Hi,
Here I am listing some of the things that you have to take care when you are working with SPSecurity.RunWithElevatedPrivilages.
1) Don't get the instances of SPSite and SPWeb from the context variables.
Eg: If you have RunWithElevatedPrivilages in Event Handlers. Don't get the instances of sitecollection and site from properties varibales directly.
Don't Use
i.e SPSite site=properties.site;
SPWeb web= properties.openweb();
Use
SPSite site = new SPSite(properties.SiteId)
SPWeb web = site.OpenWeb(properties.RelativeWebUrl)
Because the first code returns the instances with the current user prevelages. so, eventhough you are working with elevated privilages you will get access problems with those instances.
Here I am listing some of the things that you have to take care when you are working with SPSecurity.RunWithElevatedPrivilages.
1) Don't get the instances of SPSite and SPWeb from the context variables.
Eg: If you have RunWithElevatedPrivilages in Event Handlers. Don't get the instances of sitecollection and site from properties varibales directly.
Don't Use
i.e SPSite site=properties.site;
SPWeb web= properties.openweb();
Use
SPSite site = new SPSite(properties.SiteId)
SPWeb web = site.OpenWeb(properties.RelativeWebUrl)
Because the first code returns the instances with the current user prevelages. so, eventhough you are working with elevated privilages you will get access problems with those instances.
Thursday, July 22, 2010
Command to increase limit on site template size
Hello everyone,
Using the following command you can adjust the predefined limit on sharepoint list template size.
stsadm -o setproperty -pn max-template-document-size -pv 20000000
NOTE: The Max value that we can set is 524288000 bytes (500MB).
Using the following command you can adjust the predefined limit on sharepoint list template size.
stsadm -o setproperty -pn max-template-document-size -pv 20000000
NOTE: The Max value that we can set is 524288000 bytes (500MB).
Reset the IIS After updating the DLL for event receiver
Hi ,
Today, when I was working with Event Receivers for Sharepoint Lists. I got lots of troubles in debugging the code.
Actually, I had writen the code and installed DLL in to GAC. And, added the w3p process to debug the event receiver.
When I changed the code, I forgot to reset the IIS. That did not show me the debigging in a wrong way. Because it is still using the old code.
So, better reset the IIS when you make a new DLL.
NOTE:- Everyone know that we should reset when we install a new DLL we should reset IIS. But some people like me may forget or neglect it. So, Remember my case and don't forget to reset the IIS.
Today, when I was working with Event Receivers for Sharepoint Lists. I got lots of troubles in debugging the code.
Actually, I had writen the code and installed DLL in to GAC. And, added the w3p process to debug the event receiver.
When I changed the code, I forgot to reset the IIS. That did not show me the debigging in a wrong way. Because it is still using the old code.
So, better reset the IIS when you make a new DLL.
NOTE:- Everyone know that we should reset when we install a new DLL we should reset IIS. But some people like me may forget or neglect it. So, Remember my case and don't forget to reset the IIS.
Monday, July 19, 2010
SharePoint Event Handler to set Item-Level Security based on Names in a List Column
This is a nice article about the item level security Using Event Handlers.
http://warrenrapson.wordpress.com/2009/05/20/sharepoint-event-handler-to-set-item-level-security-based-on-names-in-a-list-column/
http://warrenrapson.wordpress.com/2009/05/20/sharepoint-event-handler-to-set-item-level-security-based-on-names-in-a-list-column/
Tuesday, July 6, 2010
Information Management Policy in WSS3.0
Information Management Policy is not supported in WSS 3.0. It is available only in MOSS.
Subscribe to:
Posts (Atom)