<Query><Where><Or><Membership Type="CurrentUserGroups"><FieldRef Name="Branch"/></Membership><Membership Type="CurrentUserGroups"><FieldRef Name="ATH"/></Membership></Or></Where></Query>
Replace
"<" with <
">" with >
" " " with "
Tuesday, December 1, 2009
View based on current user in sharepoint groups
Saturday, November 28, 2009
Custom Action in Sharepoint Designer Workflow
http://sarangasl.blogspot.com/2009/11/sharepoint-workflow-actions-for.html
http://blogit.create.pt/blogs/ricardocosta/archive/2007/11/02/Custom-Action-for-Sharepoint-Designer.aspx
Thursday, March 5, 2009
Add user in SP site Programatically
SPWeb web = thisSite1.OpenWeb();
web.AllowUnsafeUpdates = true;
web.SiteUsers.Add("bomcordom:" + _userid, "", _userid, "");
web.Groups[
Friday, February 13, 2009
Programmatically add users to Active Drirectory
string Fullname = "User1";
string password = "pass";
string office = "B" + strUserID;
try
{
DirectoryEntry objEntry = new DirectoryEntry();
objEntry.Path = "LDAP://AAA.com/DC=AAA,DC=com";
objEntry.Username = "AAA\\misadmin";
objEntry.Password = "mis";
DirectorySearcher userSearch = new DirectorySearcher();
userSearch.SearchRoot = objEntry;
userSearch.Filter = "(&(objectClass=user)(CN=" + strUserID + "))";
SearchResultCollection uColl = userSearch.FindAll();
if (uColl.Count == 0)
{
objEntry.Path = "LDAP://AAA.com/OU=MUsers,DC=AAA,DC=com";
//Add new user Account
DirectoryEntries users = objEntry.Children;
DirectoryEntry user = users.Add("CN=" + strUserID, "User");
//Set user properties
user.Properties["sAMAccountName"].Add(strUserID);
//Logon Name
user.Properties["userPrincipalName"].Add(strUserID + "@AAA.com");
//First Name
user.Properties["givenName"].Add(Fullname);
//Display Name
user.Properties["displayName"].Add(Fullname);
//Office
user.Properties["physicalDeliveryOfficeName"].Add(office);
user.CommitChanges();
//Set Password
object objRet = user.Invoke("SetPassword", password);
user.CommitChanges();
//Password never expires
int exp = (int)user.Properties["userAccountControl"].Value;
user.Properties["userAccountControl"].Value = exp | 0x1;
user.CommitChanges();
//Enable user account
int val = (int)user.Properties["userAccountControl"].Value;
user.Properties["userAccountControl"].Value = val & ~0x2;
user.CommitChanges();
user.Close();
objEntry.Close();
Response.Write(strUserID +" ----- User successfully added to domain");
}
else
{
Response.Write("User already exists");
}
}
catch (Exception ex)
{
Response.Write(ex.Message);
}
Tuesday, October 7, 2008
"File not found error..." whenu click on Layouts folder files..
ASP.Net Config Tool and MOSS 2007
Today our SharePoint server raised a nice exception: ‘File not Found’ when you tried to log on. Off course we were already familiar with the sound exceptions SharePoint raises so we inspected the event log.Error: Failure in loading assembly: Microsoft.SharePoint.Portal, Version=11.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c
Error: Failure in loading assembly: Microsoft.SharePoint, Version=11.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c
The solution was pretty forward, but raises the question how compatible is Microsoft with Microsoft…..
It seems that when you modify the web.config with the ASP.Net Configuration Tool, it adds an attribute (xmlns) to the <configuration> tag like so: <configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
so remove the attribute (xmlns) now thwe site would work.
Programatticaly Upload a document to Sharepoint List
Content Of Code File:
protected void Button1_Click(object sender, EventArgs e)
{
byte[] contents;
SPSite sp = new SPSite("
SPWeb site = sp.OpenWeb();
site.AllowUnsafeUpdates = true;
SPList list = site.Lists["Test"];
SPListItem myNewItem;
string strDate = System.DateTime.Now.Date.TimeOfDay.ToString();
myNewItem = list.Items.Add();
string fileName = File1.Value.Substring(File1.Value.LastIndexOf("\\") + 1);
string strFilepath = File1.Value.ToString();
StreamReader sr = new StreamReader(strFilepath);
Stream fStream = sr.BaseStream;
contents = new byte[fStream.Length];
fStream.Read(contents, 0, (int)fStream.Length);
fStream.Close();
myNewItem["Title"] = "Sendil";
myNewItem.Attachments.Add(fileName, contents);
myNewItem.Update();
// System.IO.File.Delete(strFilepath);---> Deleting a source file.......
}
Friday, October 3, 2008
Programmatically Upload file in Document Library
- http://wss.collutions.com/Lists/FAQ/DispForm.aspx?ID=190
- http://philwicklund.com/archive/2008/04/02/programmatically-uploading-a-document-into-a-document-library-with-meta-data-modifications.aspx
- http://nishantrana.wordpress.com/2008/06/26/programmatically-uploading-and-setting-permission-to-a-document-in-a-document-library-in-sharepoint/