Thursday, July 31, 2008
SharePoint Mobile Enabled Lists Document Libraries
To mobile enable a list, Modify the view you would like to make mobile, scross down to the Mobile section and check the box.
Tuesday, July 29, 2008
Convert InfoPath form to PDF Document
http://aspalliance.com/1466_Printing_InfoPath_2007_WebBased_Forms_to_PDF.6
The solution uses an open source project for the PDF generation called iTextSharp. I haven't tried it yet but I also don't know of a lot of free pdf libraries.
Monday, July 28, 2008
Programmatically remove InfoPath digital signature
Anyway, here is how to do it in InfoPath. Basically get the signature node, go to the signature child of that node and delete it.
XPathNavigator xnDoc = this.MainDataSource.CreateNavigator();
if(this.Signed) //then unsign it
{
XPathNavigator xSignedSection = xnDoc.SelectSingleNode("my:myFields/my:signatures1/my:signatures2", this.NamespaceManager);
if (xSignedSection.HasChildren)
{
xSignedSection.MoveToChild(XPathNodeType.Element); xSignedSection.DeleteSelf();
}
}
Microsoft .NET RegEx Syntax Regular Expressions
http://regexlib.com/CheatSheet.aspx
Programmatically Post to ASP page and read results
//set our data
ASCIIEncoding encoding = new ASCIIEncoding();
string postData = "firstname=" + fname.Text;
postData += ("&lastname=" + lname.Text);
//compose the submission
HttpWebRequest request = (HttpWebRequest)WebRequest.Create("https://somepage.asp");
request.Method = "POST";
request.ContentType = "application/x-www-form-urlencoded";
request.ContentLength = postData.Length;
// Post to the form.
StreamWriter swRequestWriter = new StreamWriter(request.GetRequestStream());
swRequestWriter.Write(postData);
swRequestWriter.Close();
//get the response
HttpWebResponse hwrWebResponse = (HttpWebResponse)request.GetResponse();
// Read the response
StreamReader srResponseReader = new
StreamReader(hwrWebResponse.GetResponseStream());
string strResponseData = srResponseReader.ReadToEnd();
srResponseReader.Close();
// Display the response on my page
Response.Write(strResponseData);
Now what I plan to do is screen scrape the result page and get the data I need. Ah regular expressions, I hate those. Stay tuned for that post in the next couple of days...
Thursday, July 24, 2008
Creating a SharePoint stsadm command prompt on the dektop
http://blogs.msdn.com/scicoria/archive/2008/07/24/creating-a-wss-moss-command-prompt-on-the-desktop.aspx
Finding the SQL behind a Crystal Report
After creating a new DSN (Windows XP users click here for instructions) I opened up the report in VS and clicked the Crystal Reports menu at the top. Then Database -> Show SQL Query. A wizard will popup, click the Back button, choose the newly created DSN for your database and then click Next. Login with your credentials and click Finish. Whalla (spelling??) I now see the previously hidden SQL.
InfoPath Percentage Symbol Field
That's just wrong:
Note Microsoft Office InfoPath 2003 does not add percent symbols to numbers that are formatted as percentages. To add a percent symbol to a control's label, click where you want the percent symbol to appear, and then type %.
http://office.microsoft.com/en-us/infopath/HP010938331033.aspx
Wednesday, July 23, 2008
Programmatically remove digital signatures from Excel document
Microsoft.Office.Interop.Excel.Application eApp = null; Microsoft.Office.Interop.Excel.Workbook wb = null;
//gets our workbook
eApp = new Microsoft.Office.Interop.Excel.Application();
wb = eApp.Workbooks.Open(textBox1.Text, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing);
//makes it visible and activates the workbook
//eApp.Visible = true;
//wb.Activate();
//get signatures
Microsoft.Office.Core.SignatureSet sigs = wb.Signatures;
//remove all the signatures
foreach (Microsoft.Office.Core.Signature sig in sigs)
{ sig.Delete(); }
//save and close the form
wb.Save();
wb.Close(Type.Missing, Type.Missing, Type.Missing);
wb = null;
eApp = null;
Tuesday, July 22, 2008
Sample valid credit card numbers
Visa
4111 1111 1111 1111
MasterCard
5500 0000 0000 0004
American Express
3400 0000 0000 009
Discover
6011 0000 0000 0004
EmailSubmitConnection :How to add custom email to an InfoPath email data connection EmailSubmitConnection
First, you need to create a data connection (EmailSubmitConnection) that sends an email to someone within the InfoPath data connections. This data connection needs to be created so we can reference it in our code.
Second get into the code behind of the form, I'm using C# for InfoPath 2007 so those with InfoPath 2003 may have to figure this out for themselves but hopefully this gives them some clues.
Within, probably a button click event, I get a reference to the email data connection. The "email connection" is the name of the data connection I created in the first step.
EmailSubmitConnection emailDataConnection = (EmailSubmitConnection)this.DataConnections["email connection"];
//add your custom message to the introduction, say hello to yourself
XPathNavigator xnDoc = this.MainDataSource.CreateNavigator();
XPathNavigator fullName = xnDoc.SelectSingleNode("my:myFields/my:txtFullName", this.NamespaceManager);
emailDataConnection .Introduction = "My custom introduction with some fields. Hello " + fullName.Value;
//submit the data connection which sends the email
emailDataConnection .Execute();
As you can see, just get a reference to the data connection (EmailSubmitConnection), set the Introduction property and execute. This can also be accomplished for the FileSubmitConnection and WebServiceConnection objects, so you can write code to execute these connections and set some custom properties before making the submit. Hope this helps someone.
Monday, July 21, 2008
Funny video for developers
http://www.thewebsiteisdown.com/
InfoPath Rules vs Code
There is no way to switch the OoE or Order of Execution within InfoPath. Here is a sample to close the form in code in a js script code behind. There is also no need to sign the form unless the code interacts with the SharePoint OM.
Application.XDocuments.Close(0); //will close form but keep InfoPath open
Application.Quit(bool) //will exit InfoPath and if true force an exit, if false will prompt user if they want to save the form
I used true because in a rule I submit the form so the code can go ahead and quit InfoPath.
Tuesday, July 15, 2008
Installation Instructions for Sitecore CMS 6
Here are screenshots of the Sitecore 6 installation process in case you ever get there.
Sitecore 6 Installation Screenshots
Programmatically create folder within SharePoint List
SPList list = {some SPList object}
SPListItem folder = list.Items.Add(string.empty, SPFileSystemObjectType.Folder, "Name of folder to create");
Monday, July 14, 2008
Login failed for user 'username'. The user is not associated with a trusted SQL Server connection. (Microsoft SQL Server, Error: 18452)
Login failed for user 'username'. The user is not associated with a trusted SQL Server connection. (Microsoft SQL Server, Error: 18452)
Most likely indicatest that your SQL Server is not enabled for Mixed Mode authentication, it is probably only allowing Windows logons to log onto it, make it mixed mode and then you'll be able to connect using your SQL server login account. Quick fix but unknown unless you have this information.
Friday, July 11, 2008
Import SharePoint v3 sites using stsadm -o import, replacement for smigrate
So now that you've successfully exported a WSS v3 site we need to figure out how you can import it into another WSS site or into a WSS site sitting underneath your MOSS 2007 site. Again, the export gives us some functionality that smigrate did not, mainly the ability to import user security from our exported file. Here is the command line instructions:
stsadm.exe -o import -url
-filename
-includeusersecurity
-haltonwarning
-haltonfatalerror -updateversions <1-4>
1 - Add new versions to the current file
2 - Overwrite the file and all its versions
3 - Ignore the file
4 - Terminate with conflicts
-quiet
And here is an example:
stsadm.exe -o import -url http://officepoint.blogspot.com/SiteDirectory/NewlyImportedSite -filename C:\backups\officepoint.blogspot.com.bak -includeusersecurity -haltonfatalerror -updateversions 1
This will import my backup file named officepoint.blogspot.com.bak to the site named NewlyImportedSite that sites beneath my MOSS site, it will, of course, include all of the user security from the exported site, it will stop importing if it encounters a fatal error and will update the versions of the site instead of deleting them and replacing them.
WSS (SharePoint) v3 stsadm.exe -o export, replacement for smigrate
stsadm.exe -o export -url
-filename
-overwrite
-includeusersecurity
-haltonwarning
-haltonfatalerror
-versions <1-4>
1 - Last major version for files and list items
2 - The current version, either the last major or the last minor
3 - Last major and last minor version for files and list items
4 - All versions for files and list items
-cabsize
-quiet
So an example of this would be:
stsadm.exe -o export -url http://officepoint.blogspot.com -filename C:\backups\officepoint.blogspot.com.bak -overwrite -includeusersecurity -haltonfatalerror -versions 2 -quiet
This will export the WSS located at http://officepoint.blogspot.com to a file named officepoint.blogspot.com.bak in the backups folder on my C: drive. It will overwrite any backup files already there. It will include all of the user security of the site. It will stop the export if it hits a fatal error, it will perform a quiet export and export the current version of the site.
It takes a little longer to run because of all the extra web parts and lists created with WSS v3, but it'd definitely nice to have this ability. The only question I can think of is, if I copy the stsadm executable to a WSS v2 site, will it export v2 sites with their security or is this functionality only limited to version 3?
Free favicon for your site
http://www.favicon.cc/
It has a nice search feature along with a bunch of other ones I don't use.
SQL Server Reporting Services SharePoint Set Server Defaults
I when to the Operations tab in Central Admin and clicked "Alternate access mappings" and then selected the Central Admin collection and removed all mappings except for the default one. Then went back to "Set Server Defaults" and the error went away. I could then go back and add my mappings back in and the error still did not show.
I can't explain and really don't want to know the internal workings of Reporting Services with SharePoint but the above solution worked for me, hope it works for you too.
w3wp!library!5!07/11/2008-13:03:58:: e ERROR: Throwing Microsoft.ReportingServices.Diagnostics.Utilities.InternalCatalogException: An internal error occurred on the report server. See the error log for more details., ; Info: Microsoft.ReportingServices.Diagnostics.Utilities.InternalCatalogException: An internal error occurred on the report server. See the error log for more details. ---> System.ArgumentException: Value does not fall within the expected range. at Microsoft.ReportingServices.SharePoint.Server.Utility.GetSPItemMetaDataAndContent(String path, UserContext userContext, Boolean returnContent, Guid& id, ISecurableObject& secObj, SharePointImpersonatedWeb& wrapper, Byte[]& content, String& mimeType) at Microsoft.ReportingServices.SharePoint.Server.Utility.GetSPItemType(String objectName, UserContext userContext, Guid& id, ISecurableObject& secObj, SharePointImpersonatedWeb& wrapper) at Microsoft.ReportingServices.SharePoint.Server.SharePointAuthorizationExtension.InternalCheckAccess(UserContext userContext, String itemPath, SPBasePermissions requiredRights) at Microsoft.ReportingServices.SharePoint.Server.SharePointAuthorizationExtension.CheckAccess(UserContext userContext, String path, CatalogOperation requiredOperation) at Microsoft.ReportingServices.SharePoint.Server.SharePointSecurity.CheckAccess(Byte[] secDesc, CatalogOperation catalogOperation, String catalogPath) at Microsoft.ReportingServices.Library.GetSystemPropertiesAction.PerformActionNow() at Microsoft.ReportingServices.Library.RSSoapAction`1.Execute()
Wednesday, July 9, 2008
Enable InfoPath autocomplete feature
Within IE go to the tools menu, click Options, and then click the General tab.
Under System options, click Internet Options, and then click the Content tab.
Under Personal information, click AutoComplete.
You should be able to set your autocomplete settings from that configuration.
This came from http://office.microsoft.com/en-us/infopath/HP010967791033.aspx
Tuesday, July 8, 2008
Outlook Business Contact Manager (BCM) Custom Import Tool Update #1
Outlook.ApplicationClass _app = new Outlook.ApplicationClass();
Outlook.Application olApp = (Outlook.Application)_app;
Outlook.NameSpace olNameSpace = _app.GetNamespace("MAPI");
Outlook.Folders folders = olNameSpace.Session.Folders;
Outlook.Folder bcmRootFolder = (Outlook.Folder)folders["Business Contact Manager"];
Outlook.Folder accounts = (Outlook.Folder)bcmRootFolder.Folders["Accounts"];
Outlook.UserProperty userProp;
foreach (StringDictionary account in accountList)
{
Outlook.ContactItem newAccount = (Outlook.ContactItem)accounts.Items.Add("IPM.Contact.BCM.Account");
newAccount.FullName = account["accountname"].Trim();
newAccount.FileAs = account["accountname"].Trim();
newAccount.OfficeLocation = account["officelocation"].Trim();
newAccount.Save();
//populate the account number
if (newAccount.UserProperties["Account Number"] == null)
{
userProp = newAccount.UserProperties.Add("Account Number", Microsoft.Office.Interop.Outlook.OlUserPropertyType.olText, false, false);
userProp.Value = account["accountnumber"].Trim();
}
//populate the active flag
if (newAccount.UserProperties["Active"] == null)
{
userProp = newAccount.UserProperties.Add("Active", Microsoft.Office.Interop.Outlook.OlUserPropertyType.olYesNo, false, false);
userProp.Value = account["inactive"].Trim();
}
//populate the type of business
if (newAccount.UserProperties["Type of Business"] == null)
{
userProp = newAccount.UserProperties.Add("Type of Business", Microsoft.Office.Interop.Outlook.OlUserPropertyType.olText, false, false);
userProp.Value = account["contacttypeid"].Trim();
}
//populate the business address
if (account["address2"].Trim() != string.Empty)
{
StringBuilder sbBusinessAddressStreet = new StringBuilder();
sbBusinessAddressStreet.AppendLine(account["address1"].Trim());
sbBusinessAddressStreet.AppendLine(account["address2"].Trim());
newAccount.BusinessAddressStreet = sbBusinessAddressStreet.ToString();
}
else
{
newAccount.BusinessAddressStreet = account["address1"].Trim();
}
newAccount.BusinessAddressCity = account["city"].Trim();
newAccount.BusinessAddressState = account["state"].Trim();
newAccount.BusinessAddressPostalCode = account["zipcode"].Trim();
newAccount.BusinessAddressCountry = account["country"].Trim();
//add phone and fax info
newAccount.BusinessTelephoneNumber = account["companyphone"].Trim();
newAccount.BusinessFaxNumber = account["faxnumber"].Trim();
newAccount.WebPage = account["webpageaddress"].Trim();
//custom user defined field
}
if (newAccount.UserProperties["Business Card On File"] == null)
{
userProp = newAccount.UserProperties.Add("Business Card On File", Microsoft.Office.Interop.Outlook.OlUserPropertyType.olYesNo, false, false);
userProp.Value = account["cardonfile"].Trim();
}
//add other information
newAccount.Body = account["comments"].Trim();
newAccount.Save();
Monday, July 7, 2008
InfoPath Form Template Format Structure Specification
http://download.microsoft.com/download/8/5/8/858F2155-D48D-4C68-9205-29460FD7698F/%5BMS-IPFF%5D.PDF
I wonder if they haven't had complaints about this or if there is a technical reason why -1 is hardcoded as the tabindex of that control.
InfoPath Tabbing bug - Update #1
button class="xdDTButton" title="" xd:xctname="DTPicker_DTButton" xd:innerCtrl="_DTButton" tabIndex="-1">
img title="" src="res://infopath.exe/calendar.gif"/
/button
This button is the small calendar image that when clicked opens up the date picker control. As you can see this has a tabIndex of -1 instead of the 12 that the control should have. Below is the span associated with the text portion of the date picker. Notice how that has the correct tab index.
span class="xdDTText xdBehavior_FormattingNoBUI" hideFocus="1" title="" contentEditable="true" tabIndex="12" xd:xctname="DTPicker_DTText"
MS should have made the button have a tab index of 12 too so that the next tab action goes to the next field instead of dropping down to the rest of the form.
Next question, can I change the source files without breaking the rest of the form?? What about Drop Down Lists and Radio buttons? I suspect the same thing is happening...
Remove Warning - this form is using your identity to connect to data sources
"This form is using your identity to connect to data sources"
This gets really annoying and your users may be confused. So advise them to Enable Access data sources across domains within IE -> Security Settings. The form should be within a Trusted Site or within the Local Intranet Zone so this should be ok because group policy should dictate what sites are in these zones, and if your IT group is good only very very safe sites should be in those zones, like for instance your local SharePoint intranet site.
Thursday, July 3, 2008
Ajax Loading Image
http://www.ajaxload.info/
Give your site that cool Web 2.0 look and feel with ajax and the cool ajax loading images.
Web Based Link Checker
http://blogs.iis.net/tomkmvp/archive/2008/06/26/web-based-link-checker.aspx
As soon as I get some time I will start working on this application and should be able to modify it to fit my needs. Basically go through my entire site, check links and produce a report of what needs to be fixed.
Install SharePoint on Vista
for information regarding the steps needed to install and configure SharePoint to run on Windows Vista. Finally, we can develop on our local machines without the heavy server image.
On a personal note, I am going to continue to develop on my vpc image. My reason being Vista is slow enough without SharePoint and SQL running on it, developing on a server image gives me a better chance that my application will run without issues when deployed to the SharePoint server and the big one, the installation of SharePoint on Vista is not supported by Microsoft.
Wednesday, July 2, 2008
Kayak Club of Ada
Speaking of river cleanup, I found a full size 16 speed Rally bike in the Thornapple behind the florist shop yesterday evening. I couldn't pull it out since I was on the kayak and probably would have fallen it, but I plan to get it out. Unless someone else sees this post and does it before me.
Anyway, the link to the kayak blog is http://kayakada.blogspot.com/ Please drop us a line if you'd like to participate with us.
InfoPath Tabbing Tab Index bug
I have an InfoPath form with controls defined below.
TextBox - Tab Index is 1
TextBox - Tab Index is 2
Date Picker - Tab Index is 3
TextBox - Tab Index is 4
TextBox - Tab Index is 0
If I tab through these fields, it goes down the line 1, 2, 3, 4, 0 as expected. However, if I tab from 1 to 2, 2 to 3 and then choose a date using the calendar and then tab again it goes down to the textbox with tab index of 0.
Why does this happen? Because the small calendar icon seems to be it's own control and gets focused on, it's tab index is presumably 0 even though the entire Date Picker control is 3. So when I tab from the calendar icon it goes to the next tab index of 0 which is expected. However, this is not an expected behavior from a user perspective or from any other perspective for that matter.
That entire Date Picker control should have a tab index of 3 not just the text portion of the control but the entire control including the small calendar icon.
This same behavior seems to occur for radio buttons and drop down controls as well. If instead you replace the Date Picker with a Drop Down control and the user selects a value, the next tab is to a control with a tab index of 0, even though it's expected that it should be 4 (using the example above).
Tuesday, July 1, 2008
Grand Rapids Tech Lunch #2 - July 7, 12pm Grand Rapids Brewing Company
http://grtechlunch.com/grafitti/meetings/2-grtechlunch-event-july-7-2008-grand-rapids-brewing-company/
Outlook Business Contact Manager (BCM) Custom Import Tool
Now I don't know what version BCM is, I know it was at least around with Office 2003, but it could be improved dramatically. One improvement could be the import tool. My requirement was to import an Access database into BCM into custom fields. The Microsoft import tool did not fit my needs to I wrote my own import tool to do this. I can see from the newsgroup and complaints that a custom import tool may be desired by a lot of people.
If this is the case for you, please drop me a line. I'm more than happy to release the tool I've created so that it may help you. It is easy to custom to fit your needs with a little bit of development.