April 27, 2012

Creating form in InfoPath 2010 and publishing to SharePoint 2010

In this post, I am going to create a simple form using InfoPath 2010 and publish the form to a SharePoint 2010 library and open the form using Web Browser

1. Open InfoPath 2010 Designer and Click on File | New | Select Blank Form | Click on Design Form Creating Blank Form in InfoPath 2010
2. Blank Form Template in InfoPath 2010 is created. Now I want to insert tables Blank Form template in InfoPath 2010
3. Click on Insert tab and select the table format which you want Insert Table in InfoPath 2010
4. Adding control to InfoPath 2010 Forms
To add controls to your form, click on HOME tab and go where it says Controls
image
5. If you want to add InfoPath form 2010 controls similar to InfoPath form 2007, just click on the control pane Control  Pane in InfoPath 2010
6. Now your control pane is will look like InfoPath 2007 format. InfoPath 2010 Control similar to InfoPath 2007
7. Let’s go and add controls to our new InfoPath 2010 forms.
I added four input text fields. To go to properties of the filed, just double click and name the properties
Adding Controls to InfoPath 2010 Form
Properties of the Fields in InfoPath 2010 forms InfoPath 2010 Fileds Properties
8. Now the form is ready and let’s go and publish this to SharePoint 2010 Form library.
Data | Form Options

Form Submit Options in InfoPath 2010
9. InfoPath 2010 Submit Form Options:
If you want to submit the form to SharePoint Document Library, put a check in Allow users to Submit this form
Other options are “Show the submit button in both the ribbon and the info tab in the InfoPath filter

image
10. If your satisfy with all the all the options, click Ok. This will give you a message saying “ You must select a data connection for Submitting data to a SharePoint document library. To create a new data connection, click ADD”
Let’s go and click Add to create new data connection to SharePoint 2010 Document Library
image

11. Data Connection Wizard: This wizard helps you to specify a data connection for submitting the form to a document library on SharePoint site. The form will be submitted with the file name specified below
I already have created a Form Library in SharePoint 2010. If you don’t have the link for the Form Library go to your SharePoint site and create a Form Library.

In File Name, I selected as name and the form will be submitted with the file name specified below
InfoPath 2010 Data Connection Wizard
To insert File Name : Click on Fx Icon
Insert Filed or Group in InfoPath Form 2010
12. Enter a name for this data connection and click on Finish and Ok for next Window
Name for Data Connection in InfoPath 2010
13. Now the data connection to document library is completed and now we can publish the form to SharePoint 2010
To publish the form, go to File | Publish and | SharePoint Server |

Publish form to a SharePoint Library
- Create or update a form library form on SharePoint
- Users can access this form Online

Publish form to a SharePoint Library
14. Publishing Wizard will come up to publish the form to SharePoint Document Library. In here the wizard wants you to enter the location of your SharePoint or InfoPath Form Services site.
Enter the site name which you want to publish the form.

Click NextInfoPath Form Services Site

15. Enable this form to be filled out by using browser if you want user to fill the form online. Also we are publishing this form to a document library

Publishing to Form Library in InfoPath 2010
16. What do you want to do?
- Create a new form library or Update the form template in an existing from library.

Since I already have a form library created, I am going to update my form template in an existing form library
Create a new form library InfoPath
17. The files listed below will be available as columns in SharePoint sites and Outlook Folder. Go head and select the fields which you want to capture.
Selecting Fields in Infopath

18. Click next and publish the InfoPath form to SharePoint 2010 Library SNAGHTML4dc07a7

19. Form is published to SharePoint and click on open in form in the Browser
Open InfoPath form in browser

20. InfoPath Form opens in browser and it’s ready to be filled and submit to form library.
Submit Form to SharePoint
21. Form filed information are captured in Form Library in SharePoint 2010
Form data in Form Library
If you want to know how to disable some of the features in the form submit options, please see :

April 17, 2012

Importing SharePoint 2007 list templates (STP) into SharePoint 2010

  1. Rename the original .STP to .CAB
  2. Extract its manifest.xml to a local folder (lets call it {workingfolder})
  3. Search for the ProductVersion element. This should have a value of 3
  4. Change its value to 4
  5. Repackage the manifest.xml into a .CAB. I've done this by using makecab.exe in the C:\Windows\System32 folder
    Syntax
    : makecab.exe {workingfolder}\manifest.xml {workingfolder}\{template-name}.cab

  6. Change the generated cabinet's extension from .CAB back to .STP and upload it into the _catalogs/lt


Example:c:\Windows\System32>makecab.exe C:\Users\Administrator\Desktop\QueriesList\manif
est.xml C:\Users\Administrator\Desktop\QueriesList.stp

How to Create an ASMX Web Service on SharePoint 2010, Using Visual Studio 2010

Back in SharePoint 2007, asmx web services were quite prevalent, thanks to the
WSPBuilder tool, and it’s templates. They are useful for executing
actions between multiple web applications and can be used by client
applications, as well. Furthermore, InfoPath forms, deployed to  SharePoint, could also use these asmx web services.


unfortunately,
Visual Studio 2010 did not come with a template for SharePoint web
services. So, today I will be writing about how we can create asmx web
services for SharePoint 2010. All you will need is SharePoint 2010.

First,
start a new Empty SharePoint 2010 project. I will call this SPASMXService.




Make
sure to deploy it as a farm solution.










First,
you need to close this project by right clicking on the project and then
selecting ‘unload project’.






Then,
right click on the project again, and select, ‘Edit SPASMXService’.







Under <SandboxedSolution>False</SandboxedSolution> type in:


<TokenReplacementFileExtensions>asmx</TokenReplacementFileExtensions>


This will be the result:




Then, save and close out of this xml
file. This will allow Visual Studio to insert the solution information
where necessary. Therefore, this is a crucial step! Finally, reload
the project file.




Next, we will be creating the web
service. Right click on the project, and select “Add” and then select
“New Class…” This will be the code behind. Let’s just call this SPASMXService.cs.











Now, open SPASMXService.cs, and make
the following changes:









This is a good start for a web
service with a web method. Now, of course we have a few errors because we
still have not brought in the necessary libraries. Right click on
‘references’ in the Solution Explorer, and select, ‘Add Reference’.
Select System.Web.Services from the .NET tab. Then, in SPASMXService.cs,
add, ‘using System.Web.Services’. This should look like this:










Finally, we have to create the
service page. I like to keep it in the _layouts folder, but you can keep
it elsewhere using similar steps. Right click on the project item in the
solution explorer, and select add -> SharePoint “Layouts” Mapped Folder.





You can also select SharePoint
Mapped Folder, and then select ISAPI. This would cause the page to go
into _vti_bin instead.


For now, I’m going to stick to
_layouts:






The SPASMXService folder was
automatically made. Nice.


Inside the SPASMXService, under
Layouts, we will add a new file of type xml. We Shall call it SPASMXService.asmx.











The contents of SPASMXService.asmx
will be a single line:




<%@ WebService Language="C#" Debug="true" Class="[Class path], $SharePoint.Project.AssemblyFullName$"

%>



Where [class path] is the full
namespace name of the SPASMXService class in SPASMXService.cs. In my
case, the line will be:







From:



Finally, save everything, and then
deploy the solution.










If everything went right, you should
see this using Internet Explorer:












if you used ISAPI instead of
Layouts, _layouts in that screenshot should be _vti_bin, instead. If you
opened this from a front end server with web service, then you can further test
this web service by clicking on that link.




Lastly, a bit of trouble shooting;
you can check on the web service page by going to:



C:\Program Files\Common
Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\LAYOUTS



If you used ISAPI instead of
LAYOUTS, then instead go to:



C:\Program Files\Common
Files\Microsoft Shared\Web Server Extensions\14\ISAPI

If the web service does not load on
Internet explorer, then you should open the asmx page from one of these two
locations. If you open the asmx page from one of these two locations, and
you still find “$SharePoint.Project.AssemblyFullName$”,then you need to go back to the top of this article and follow the steps
regarding unloading and reloading the project.

Manage users in SharePoint 2010 using active directory

To manage users in SharePoint 2010 using active directory, please follow these steps: 1.Log into your server through Remote Desktop Connection (instructions for connecting to your server through RDC can be found here).
2.Navigate to Start > Administrative Tools > Active Directory Users and Computers.
3.Expand the active directory domain and right-click Users and choose New > User.
4.Enter in the user's name, username (login name) and click Next.
5.After clicking Next you will be prompted to enter in a password for the user. Enter in a secure password, click Next, and then click Finish.
6.The AD user is now setup.
7.To add the user to SharePoint, log into the SharePoint site as the account administrative user.
8.Navigate to Security and click the Security link.

April 12, 2012

How to Backup and Restore Active Directory on Server 2008


Before you can backup Server 2008 you need to install the backup features from the Server Manager.
1. To install the backup features click Start → Server Manager.

How to Backup and Restore Active Directory on Server 2008 - 1
2. Next click Features → Add Features


How to Backup and Restore Active Directory on Server 2008 - 2

3. Scroll to the bottom and select both the Windows Server Backup and the Command Line Tools
How to Backup and Restore Active Directory on Server 2008 - 3

4. Click Next, then click Install

Backing up Server 2008 Active Directory

Now that we have the backup features installed we need to backup Active Directory. You could do a complete server backup, but what if you need to do an authoritative restore of Active Directory?
As you’ll notice in Server 2008, there isn’t an option to backup the System State data through the normal backup utility.




How to Backup and Restore Active Directory on Server 2008 - 4
So what do we do? We need to go “command line” to backup Active Directory.
1. Open up your command prompt by clicking Start and type “cmd” and hit enter.
2. In your command prompt type “wbadmin start systemstatebackup -backuptarget:e:” and press enter.
Note: You can use a different backup target of your choosing
3. Type “y” and press enter to start the backup process.



How to Backup and Restore Active Directory on Server 2008 - 5
When the backup is finished running you should get a message that the backup completed successfully. If it did not complete properly you will need to troubleshoot.



How to Backup and Restore Active Directory on Server 2008 - 6
Now you have a system state backup of your 2008 Server!

Authoritative Restore of Active Directory

So now what if you accidentally delete an OU, group, or a user account and it’s already replicated to your other servers? We will need to perform an authoritative restore of the Active Directory object you accidentally deleted.
1. To do this you will need to boot into DSRM (Directory Services Restore Mode) by restarting your server and pressing F8 during the restart.
2.Choose Directory Services Restore Mode from the Advanced Boot menu.



How to Backup and Restore Active Directory on Server 2008 - 7
3. Login to your server with your DSRM password you created during Active Directory installation.
4. Once you’re logged into your server and in DSRM safe mode, open a command prompt by clicking Start, type “cmd“, and press enter.
5. To make sure you restore the correct backup it’s a good idea to use the “wbadmin get versions” command and write down the version you need to use.


How to Backup and Restore Active Directory on Server 2008 - 8
6. Now we need to perform a non-authoritative restore of Active Directory by typing “wbadmin start systemstaterecovery -version:04/14/2009-02:39“.
Note: The version of backup will vary depending on your situation. Type “y” and press enter to start the non authoritative restore.
7. Go grab some coffee and take a break while the restore completes.



How to Backup and Restore Active Directory on Server 2008 - 9
8. You can mark the sysvol as authoritative by adding the –authsysvol switch to the end of the wbadmin command.


How to Backup and Restore Active Directory on Server 2008 - 10

9. But if you want to restore a specific Active Directory object then you can use the ever familiarntdsutil.
For this example we are going to restore a user account with a distinguished name of CN=Test User,CN=Users,DC=home,DC=local. So the commands would be:
ntdsutil
activate instance ntds
authoritative restore
restore object “cn=Test User,cn=Users,dc=home,dc=local”
Note: The quotes are required


How to Backup and Restore Active Directory on Server 2008 - 11
10. Reboot your server into normal mode and you’re finished. The object will be marked as authoritative and replicate to the rest of your domain.

Using Active Directory Snapshots

There is a really cool new feature in Windows Server 2008 called Active Directory Snapshots. Volume Shadow Copy Service now allows us to take a snapshot of Active Directory as a type of backup. They are very quick to create and serve as another line of defense for your backup strategy.
With your server booted into normal mode open a command prompt by clicking Start, type “cmd“, and press enter.
We are going to use the ntdsutil again for creating the Active Directory snapshots. The commands are:
ntdsutil
snapshot
activate instance ntds
create
quit
quit


How to Backup and Restore Active Directory on Server 2008 - 12
So now that you have a snapshot of AD, how do you access the data? First we need to mount the snapshot using ntdsutil. The commands are:
ntdsutl
snapshot
list all
mount 1 — (Note: You should mount the correct snapshot you need; for this example there is only 1.)

quit
quit


How to Backup and Restore Active Directory on Server 2008 - 13
Your snapshot is mounted, but how do you access the data? We need to use the dsamain command to accomplish this. Then we need to select an LDAP port to use. The command is as follows:

dsamain –dbpath c:\$SNAP_200905141444_VOLUMEC$\WINDOWS\NTDS\ntds.dit –ldapport 10001
The result should look like this:


How to Backup and Restore Active Directory on Server 2008 - 14
Now we need to go to Start, Administrative Tools, then Active Directory Users andComputers.
Right click Active Directory Users and Computers and select Change Domain Controller.




How to Backup and Restore Active Directory on Server 2008 - 15
In the area that says < Type a Directory Server name [:port] here running the dsamain command.> enter the name of your server and the LDAP port you used when
For my example it would be: WIN-V22UWGW0LU8.HOME.LOCAL:10001


How to Backup and Restore Active Directory on Server 2008 - 16
Now you can browse the snapshot of Active Directory without affecting anything else negatively.