Infopath

How to add a manager for a user in Active directory using Infopath web forms

One creating a new user in Active Directory (AD), you might want to add or assign  a manager to the user.  Below is the function to add a manager to the user using infopath web forms

Public Sub AddManager(ByVal dEntry As DirectoryEntry, ByVal ManagerAccount As String, ByVal loginname As String)
            Try
                Dim ManagerSAM As String = ManagerAccount
                Dim ManagerSearcher As New DirectorySearcher()
                ManagerSearcher.PageSize = 10
                ManagerSearcher.Filter = “(&(objectCategory=user) (samAccountName=” & ManagerAccount & “))”
                ManagerSearcher.PropertiesToLoad.Add(“DistinguishedName”)
                ManagerSearcher.SearchScope = SearchScope.Subtree

                Dim managerResult As SearchResult
                Dim ManagerResultCol As SearchResultCollection = ManagerSearcher.FindAll()
                If ManagerResultCol Is Nothing Then
                Else
                    managerResult = ManagerResultCol(0)
                    Dim ManagerName As String = String.Format(managerResult.Properties(“DistinguishedName”)(0))
                    SetADProperty(dEntry, “Manager”, ManagerName)
                End If
            Catch ex As Exception
                MessageBox.Show(ex.Message, “Active Directory Error”, MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1)
            End Try
        End Sub

1 comment - What do you think?  Posted by Tosh - November 21, 2011 at 9:50 am

Categories: Administration, Code Samples, Infopath   Tags: , ,

This InfoPath form template is browser-compatible, but it cannot be browser-enabled on the selected site

I was trying to publish InfoPath Form (browser enabled) to a SharePoint document library and got these errors.
This form template is browser-compatible, but it cannot be browser-enabled on the selected site. This may be caused by one of the following reasons:

- The server is not running InfoPath Forms Services.

- The necessary features are not available on the site collection.

- They policy setting on the server does not allow users to browser-enable form templates.

I Checked

- all features were running on sitecollection level and at site level

But here is the solution, i do not why it worked but it did work.

Although you can activate and deactivate Office SharePoint Server Enterprise Site Collection features , Office SharePoint Server Enterprise Site features through site collection features and site features. But give it a try through STSADM
Solution:
stsadm -o deactivatefeature -filename IPFSSiteFeatures\feature.xml -force -url %SITE_COLLECTION_URL%
stsadm -o deactivatefeature -filename IPFSWebFeatures\feature.xml -force -url %SITE_COLLECTION_URL%
STSADM.EXE -o activatefeature -filename IPFSSiteFeatures\feature.xml -url %Sitecollection_URL% -force
STSADM.EXE -o activatefeature -filename IPFSWebFeatures\feature.xml -url %sitecollection_URL% -force

*NOTE: The “%Sitecollection_URL%” is a place holder that would be replaced with your site collection URL, such as: http://sharepoint/sitecollection

Be the first to comment - What do you think?  Posted by Tosh - July 7, 2010 at 2:18 pm

Categories: Administration, Infopath, Sharepoint Errors   Tags: , ,