Como a: Log e definições de configuração dos serviços de formulários do InfoPath Redefinir
Para fins dessa tarefa, a classe FormsService T:Microsoft.Office.InfoPath.Server.Administration.FormsService e associado membros são usados para definir os valores usar como padrão para a maioria dos itens na página a Configure InfoPath Forms Services do site SharePoint 3.0 Central Administration.
A forma contém um botão e um valioso caixa de texto. Quando executado, o valioso caixa de texto é preenchida com o nome do membro da classe usado para definir uma propriedade configuração e os valores antigos e novos de cada membro.
Dica
Este tópico assume que Microsoft Visual Studio 2005 está instalado no front-end da Web (WFE) ou servidor único farm execução Os serviços de formulários do InfoPath.
Configurar O Project
Crie um novo Visual Basic Windows Application projeto em Microsoft Visual Studio 2005.
O menu do projeto, clique em Adicionar Referência .
Na guia .NET da caixa diálogo **** Add Reference, selecione Windows ® SharePoint ® Services e clique OK.
O menu do projeto, clique em Adicionar Referência novamente.
Na guia Procurar do **** Add Reference caixa de diálogo, procurar para o
Microsoft.Office.InfoPath.Server.dll
Microsoft.Office.InfoPath.Server.dll assembly, geralmente localizado em C:\Program Files\Microsoft Office Servers\12.0\Bin\. Selecione o assembly e clique OK .
Adicionar controles e código do formulário
Adicione o seguinte controles para a forma. Eles podem ser encontrados na categoria All Windows Forms do Visual Studio a Caixa de ferramentas :
Um controle de botão
Um **** controle RichTextBox
Renomear o botão para "List and Reset Configuration Settings" Modificando o propriedade Texto do botão no Properties Window .
Reposicionar e redimensionar a forma e os controles até que todo o texto podem ser vistos sobre o botão e o controle RichTextBox preenche a maioria da forma.
O modo de exibição **** menu, clique em código .
Cole a codificar abaixo o janela de código, substituindo todos os codificar existente.
Clique em Form1.vb [Design] sobre o menu janela.
O Janela de propriedades , clique no caixa drop-down list e selecione button1 .
O Janela de propriedades , clique no botão o eventos, que é geralmente o quarto botão do lado esquerdo na linha de botões abaixo a caixa drop-down list.
O **** ação seção, clique no drop-down para o evento Click e selecione button1_Click .
O arquivo menu, clique em salvar todos os .
Pressione F5 para executar o aplicativo.
Exemplo
Use os procedimentos acima para criar um novo aplicativo do Windows Visual Basic que usa este exemplo de código log e redefinir configurações configuração Os serviços de formulários do InfoPath.
Imports Microsoft.SharePoint.Administration
Imports Microsoft.Office.InfoPath.Server.Administration
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim LocalFormsService As FormsService
Dim LocalFarm As SPFarm = SPFarm.Local
Dim StrLog As String = ""
Try
LocalFormsService = LocalFarm.Services.GetValue(Of FormsService)(FormsService.ServiceName)
'Build a string with the old a new value of each property
With LocalFormsService
StrLog = StrLog + "ActiveSessionsTimeout changed from " + _
.ActiveSessionsTimeout.ToString() + " to 1440." + Environment.NewLine
.ActiveSessionsTimeout = 1440
StrLog = StrLog + "AllowEmbeddedSqlForDataConnections changed from " + _
.AllowEmbeddedSqlForDataConnections.ToString() + " to False." + Environment.NewLine
.AllowEmbeddedSqlForDataConnections = False
StrLog = StrLog + "AllowUdcAuthenticationForDataConnections changed from " + _
.AllowUdcAuthenticationForDataConnections.ToString() + " to False." + Environment.NewLine
.AllowUdcAuthenticationForDataConnections = False
StrLog = StrLog + "AllowUserFormBrowserEnabling changed from " + _
.AllowUserFormBrowserEnabling.ToString() + " to True." + Environment.NewLine
.AllowUserFormBrowserEnabling = True
StrLog = StrLog + "AllowUserFormBrowserRendering changed from " + _
.AllowUserFormBrowserRendering.ToString() + " to True." + Environment.NewLine
.AllowUserFormBrowserRendering = True
StrLog = StrLog + "AllowUserFormCrossDomainDataConnections changed from " + _
.AllowUserFormCrossDomainDataConnections.ToString() + " to False." + Environment.NewLine
.AllowUserFormCrossDomainDataConnections = False
StrLog = StrLog + "AllowViewState changed from " + _
.AllowViewState.ToString() + " to False." + Environment.NewLine
.AllowViewState = False
StrLog = StrLog + "DefaultDataConnectionTimeout changed from " + _
.DefaultDataConnectionTimeout.ToString() + " to 10000." + Environment.NewLine
.DefaultDataConnectionTimeout = 10000
StrLog = StrLog + "MaxDataConnectionResponseSize changed from " + _
.MaxDataConnectionResponseSize.ToString() + " to 1500." + Environment.NewLine
.MaxDataConnectionResponseSize = 1500
StrLog = StrLog + "MaxDataConnectionTimeout changed from " + _
.MaxDataConnectionTimeout.ToString() + " to 20000." + Environment.NewLine
.MaxDataConnectionTimeout = 20000
StrLog = StrLog + "MaxPostbacksPerSession changed from " + _
.MaxPostbacksPerSession.ToString() + " to 75." + Environment.NewLine
.MaxPostbacksPerSession = 75
StrLog = StrLog + "MaxSizeOfFormSessionState changed from " + _
.MaxSizeOfFormSessionState.ToString() + " to 4194304." + Environment.NewLine
.MaxSizeOfFormSessionState = 4194304
StrLog = StrLog + "MaxUserActionsPerPostback changed from " + _
.MaxUserActionsPerPostback.ToString() + " to 200." + Environment.NewLine
.MaxUserActionsPerPostback = 200
StrLog = StrLog + "RequireSslForDataConnections changed from " + _
.RequireSslForDataConnections.ToString() + " to False." + Environment.NewLine
.RequireSslForDataConnections = False
StrLog = StrLog + "ViewStateThreshold changed from " + _
.ViewStateThreshold.ToString() + " to 40960." + Environment.NewLine
.ViewStateThreshold = 40960
End With
'Populate the rich text box with the log
RichTextBox1.Text = StrLog
Catch ex As Exception
MessageBox.Show("An error has occurred: " + ex.Message.ToString())
End Try
End Sub
End Class