Wednesday, April 11, 2012

InfoPath 2010 Repeating Table Updates Field On Change

When working in InfoPath you can run into business situations where a fields value is set based on user selections in other fields.  This can add a layer of complexity when the fields exist in a Repeating Table as each row needs to be executed independently.  But do nt worry there is a simple solution for this requirement as each InfoPath form is just a structured XML document on the back end.  This solution is given as code behind as this provides the quickest solution.  The sample below executes on a change event of a control in a repeating table and not on the insertion of a row as this would present null issues in the code.

public void Control_Changed(object sender, XmlEventArgs e)

{
//check to ensure value changed and not just row add if so run the code
if (e.Operation == XmlOperation.ValueChange)
{
//connect to current row in dom
XPathNavigator xnDoc = e.Site.CreateNavigator();
xnDoc.MoveToParent();                               
//select node that was changed in current row
string myVar = xnDoc.SelectSingleNode("my:Node", this.NamespaceManager).Value.ToString();
//select node in current row to update
XPathNavigator UpdateNode = xnDoc.SelectSingleNode("my:NodeToUpdate"this.NamespaceManager);
UpdateNode.SetValue(myVar);
}

}

Thursday, March 8, 2012

Forms Based Authentication on an exisiting SharePoint 2010 Classic Mode web app

If you are trying to implement Forms Based Authentication on an exisiting SharePoint 2010 web application there is no way through Central Administration to change your existing Classic Mode Web Application to Claims Based.  Below is a quick and easy PowerShell script that will accomplish this for you.

$webapp = Get-SPWebApplication "http://yourwebappurl/"
$webapp.UseClaimsAuthentication = "True"
$webapp.Update()
$webapp.ProvisionGlobally()

At this point you are now set to complete the steps to implement Forms Based Authentication on your Web Application.

Wednesday, November 2, 2011

MUSCLE MAN...HULK OUT!!

Great after dinner action with my son showing his muscle pose after eating all of his celery like the wonder pets! 

Thursday, September 22, 2011

Blessed

Not sure if anyone else likes the show modern family but i love it. I mean i crack up like i havent ever or at least in a long time over a tv show. And i love it because they seem like a family. And is there anything better or more valuable than family? Today I took my son to the first of what i hope is many times to the golf course. And he had the time of his life. He absolutely had a blast. He loved being outside! He ran and splashed in mud puddles and had the time of his life. He even got to drive the golf cart. There was one scary moment but we made it through that too. Thank God!! We almost flipped the whole cart trying to catch his cap. Check him out.




On top of all this I birdied 17!

Friday, September 16, 2011

Rain

Thank you Lord for the rain that fell here in DFW. I dont remember the last time we saw rain. And my daughter says "God bless you Lord."

Thats a nice ending to a thank you blog post.

Thursday, September 15, 2011

Trying again....

This time i am back and hopefully here to chill a while. I have some good code snips to share and just ramblings on a windows and now apple life. 1st blog post from the ipad.

Tuesday, August 24, 2010

Add Active Directory Users to SharePoint Group

string loginName = null;


string loginEmail = null;

SPSite thisSite = null;

SPWeb thisWeb = null;

SPGroup thisGroup = null;

DirectoryEntry user = null;



DirectoryEntry directoryEntry = new DirectoryEntry(ldap://yourdomain/);

DirectorySearcher ds = new DirectorySearcher(directoryEntry);

ds.Filter = "(&(objectClass=group)(cn=yourgroup))";



object groupMembers = ds.FindOne().GetDirectoryEntry().Invoke("Members", null);

foreach (object groupMember in (IEnumerable)groupMembers)

{

user = new DirectoryEntry(groupMember);

if (!(user.Properties["sAMAccountName"].Value == null))

{

loginName = user.Properties["sAMAccountName"].Value.ToString();

}



if (!(user.Properties["mail"].Value == null))

{

loginEmail = user.Properties["mail"].Value.ToString();

}



string userName = user.Name.Remove(0, 3).Replace("\\", "");





thisSite = new SPSite("http://yoursite");

thisWeb = thisSite.OpenWeb();

thisGroup = thisWeb.SiteGroups["yourgroup"];

try

{



if (thisGroup.Users["yourdomain\\" + loginName].LoginName.ToString() == loginName) { }

}

catch

{

thisGroup.AddUser("yourdomain" + loginName, loginEmail, userName, "Added by System.");

}

}

thisWeb.Dispose();

thisSite.Dispose();

user.Dispose();

ds.Dispose();