Microsoft Surface will be released this winter and is a breakthrough technology .This amazing technology will bring computers to another level for sure. Surface Computing is no longer a dream. Imagine if this is combined with real time collaboration , then this world would be a lot easier place to live in!
Title: Top Tips to write better code for SharePoint
Description: If you have not dived into SharePoint programming yet and/or would like to learn more techniques, don’t forget to mark your calendar for June 20th where I will introduce some tips and tricks to make your journey in programming the SharePoint object model easier. This demo contains hints and guidelines that will help you with gaining a better understanding on how to write better code to build collaborative applications. If you are intrested ,please register here.
Using browser interface and out-of-the-box, you cannot unblock “Created By” or “Modified By” because, according to SDK, they are kind of predefined fields based on the current logged-in user. However, using object model there is a way to change these two fields or “Assigned To” field programmatically. Below, you can see a code snippet that assigns a cross-site group to “Assigned To”, a domain group to “Created By” and finally an individual user to “Modified By” field. I have used SPUser.AllUsers[string name] to get the context of my user or group. This method requires that the user passed as the parameter (individual user or group) to be either members of the site or who have browsed to the site as authenticated members of a domain group in the site. If not, this method cannot find the user and you should get an SPUser object representing a the user which has never connected himself to a site. I will cover this one in another post , but for now let’s assume that our user (or group) exists in the site’s membership somehow.
Think twice before you implement such a functionality at list item because if there is any functionalities based on these fields and current logged-in user , they will be messed up since you have overwritten current logged-in user with your choice of security context. In such a scenario, I personally prefer to create a custom field instead of playing around with these fields.
I do receive a lot of emails from people who are seeking for help,specially since my blog’s anonymous comment has stopped working and I lost all my comments
I usually keep all the questions in an Excel sheet for further analysis. The other day I had the chance to go over all the questions and to my surprise; one of the most frequent questions is about content query web part and in particular this question:
“Why Content Query Web Part is not showing up in my web part catalog?”
There are two important things that you need to remember.
First of all, CQWP is part of MOSS 2007 and not WSS. There is a workaround (with some drawbacks) to implement CQWP functionality to an extend in WSS .Check this out:
Secondly, Content Query Web Part along with Summary Link Web Part and Table of Contents Web Part only show up if you have the Publishing Feature enabled on your site collection.
Hope this helps.
Assuming that you have already set up the membership provider and configured your SharePoint site to use Forms based authentication, here are the steps to add a user to the data store (via membership) and associating it to the Visitors group. You can extend this code to support other group associations such as owners, contributor or even your own custom groups.
1) After you add a new user to the data source using the membership provider, examine the returned status parameter and act accordingly as shown below. You can find the complete code here as a web part.
2) Install the web part included in this post (you need to add the class to a solution ,compile it and deploy it yourself:))
3) Now, log in to the site using a user name and password which has appropriate access to the membership provider.
4) Add a new user (e.g. username : chado , password:pass@word1)
5)New user(chado) should have been added to the visitor group which also means that new user has been successfully added to the data source.
6)Sign in as a different user
7) Since you are using forms authentication, you will be redirected to the login.aspx page. Enter the right credentials (chado,pass@word1) and hit “Sign In” button.
8) Now, you are logged in under the new user’s security context. This user is a visitor to this site.