/// <summary> /// Determines if a full trust proxy is installed to the farm. /// </summary> /// <param name="args">Provides the arguments defining the full trust proxy to check for installation, must be of type <see cref="ProxyInstalledArgs"/></param> /// <returns>true if the proxy is installed in the farm, false if not installed, or an exception representing an error if an error occurred</returns> public override object Execute(SPProxyOperationArgs args) { if (args == null) { throw new ArgumentNullException("args"); } var proxyInstalledArgs = args as ProxyInstalledArgs; if (proxyInstalledArgs == null) { string message = string.Format(CultureInfo.CurrentCulture, Resources.InvalidProxyArgumentType, typeof(ProxyInstalledArgs).FullName, args.GetType().FullName); var ex = new ConfigurationException(message); return(ex); } else if (proxyInstalledArgs.TypeName == null) { return(new ArgumentNullException("ProxyInstalledArgs.TypeName")); } else if (proxyInstalledArgs.AssemblyName == null) { return(new ArgumentNullException("ProxyInstalledArgs.AssemblyName")); } try { return(GetProxyInstalled(proxyInstalledArgs.AssemblyName, proxyInstalledArgs.TypeName)); } catch (Exception excpt) { return(excpt); } }
public override object Execute(SPProxyOperationArgs args) { if (args == null) { throw new ArgumentNullException("args"); } try { AccountsPayableProxyArgs proxyArgs = args as AccountsPayableProxyArgs; string vendorName = proxyArgs.VendorName; double accountsPayable = 0.0; BasicHttpBinding binding = new BasicHttpBinding(); binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Windows; binding.Security.Mode = BasicHttpSecurityMode.TransportCredentialOnly; EndpointAddress endpointAddress = new EndpointAddress(address); using (ChannelFactory <IVendorServices> factory = new ChannelFactory <IVendorServices>(binding, endpointAddress)) { IVendorServices proxy = factory.CreateChannel(); accountsPayable = proxy.GetAccountsPayable(vendorName); factory.Close(); } return(accountsPayable); } catch (Exception excpt) { return(excpt); } }
public override object Execute(SPProxyOperationArgs args) { if (args as CatalogizerArgs == null) return false; var catArgs = args as CatalogizerArgs; catArgs. }
/// <summary> /// Implements the full trust proxy for tracing information to the ULS from the sandbox. /// </summary> /// <param name="args">The arguments for the operation, must be of type <see cref="TracingOperationArgs"/></param> /// <returns>null if successful, or an exception representing an error if an error occurred</returns> public override object Execute(SPProxyOperationArgs args) { Validation.ArgumentNotNull(args, "args"); try { var proxyArgs = args as TracingOperationArgs; if (proxyArgs == null) { return(new ArgumentException(string.Format(CultureInfo.CurrentCulture, Resources.InvalidProxyArgProvided, args.GetType().AssemblyQualifiedName, typeof(LoggingOperationArgs).AssemblyQualifiedName))); } if (proxyArgs.Message == null) { return(new ArgumentNullException("proxyArgs.Message")); } ILogger logger = SharePointServiceLocator.GetCurrent().GetInstance <ILogger>(); string sandboxMessage = null; if (proxyArgs.SiteID != null) { using (SPSite site = new SPSite((Guid)proxyArgs.SiteID)) { sandboxMessage = string.Format(CultureInfo.CurrentCulture, Resources.SandboxTraceMessage, site.ID, site.RootWeb.Name, proxyArgs.Message); } } else { sandboxMessage = string.Format(CultureInfo.CurrentCulture, Resources.NoSiteContextTraceMessage, proxyArgs.Message); } if (proxyArgs.Severity == null) { logger.TraceToDeveloper(sandboxMessage, proxyArgs.EventId, proxyArgs.Category); } else { var severity = (SandboxTraceSeverity)proxyArgs.Severity; logger.TraceToDeveloper(sandboxMessage, proxyArgs.EventId, severity, proxyArgs.Category); } return(null); } catch (Exception exception) { return(exception); } }
public override object Execute(SPProxyOperationArgs args) { if (args == null) { throw new ArgumentNullException("args"); } try { var proxyArgs = args as ConfigSerializeArgs; var configSerializer = new ConfigSettingSerializer(); string serializeData = configSerializer.Serialize(proxyArgs.TypeToSerialize, proxyArgs.ValueToSerialize); return(serializeData); } catch (Exception excpt) { return(excpt); } }
public override object Execute(SPProxyOperationArgs args) { if (args != null) { string tempPath = Environment.GetEnvironmentVariable("TEMP", EnvironmentVariableTarget.Machine); FullTrustProxyArgs fileArgs = args as FullTrustProxyArgs; FileStream fStream = new FileStream(tempPath + @"\SPFullTrustProxyLog.txt", FileMode.Append); fStream.Write( System.Text.ASCIIEncoding.ASCII.GetBytes(fileArgs.FileContents), 0, fileArgs.FileContents.Length); fStream.Flush(); fStream.Close(); return(fileArgs.FileContents); } else { return(null); } }
/// <summary> /// Implements the operation for determining if a key exists in a web application /// </summary> /// <param name="args">The arguments for the contains key operation. This must be an instance of ContainsKeyDataArgs.</param> /// <returns>true if the key found, false if the key is not found, or an exception representing an error if an error occurred</returns> public override object Execute(SPProxyOperationArgs args) { if (args == null) { throw new ArgumentNullException("args"); } var containsKeyArgs = args as ContainsKeyDataArgs; if (containsKeyArgs == null) { string message = string.Format(CultureInfo.CurrentCulture, Resources.InvalidProxyArgumentType, typeof(ContainsKeyDataArgs).FullName, args.GetType().FullName); var ex = new ConfigurationException(message); return(ex); } else if (containsKeyArgs.Key == null) { return(new ArgumentNullException("ContainsKeyDataArgs.Key")); } try { ConfigLevel level = (ConfigLevel)containsKeyArgs.Level; if (containsKeyArgs.Key.StartsWith(ConfigManager.PnPKeyNamespace) == false) { string message = string.Format(CultureInfo.CurrentCulture, Resources.InvalidKeyName, containsKeyArgs.Key); ConfigurationException ex = new ConfigurationException(message); return(ex); } else { bool contains = false; if (level == ConfigLevel.CurrentSPWebApplication) { if (containsKeyArgs.SiteId == Guid.Empty) { return(new ConfigurationException(Resources.EmptySiteGuid)); } using (SPSite site = new SPSite(containsKeyArgs.SiteId)) { SPWebAppPropertyBag bag = new SPWebAppPropertyBag(site.WebApplication); contains = bag.Contains(containsKeyArgs.Key); } } else if (level == ConfigLevel.CurrentSPFarm) { var bag = new SPFarmPropertyBag(SPFarm.Local); contains = bag.Contains(containsKeyArgs.Key); } else { string message = string.Format(CultureInfo.CurrentCulture, Resources.InvalidConfigLevel, level.ToString()); ConfigurationException ex = new ConfigurationException(message); return(ex); } return(contains); } } catch (Exception excpt) { return(excpt); } }
public override object Execute(SPProxyOperationArgs args) { var rssArgs = args as RssReaderArguments; return rssArgs == null ? null : XElement.Load(rssArgs.FeedUrl); }
public override object Execute(SPProxyOperationArgs args) { return null; }
public object ExecuteRegisteredProxyOperation(string assemblyName, string typeName, SPProxyOperationArgs args) { if (ExecuteRegisteredProxyOperationException != null) { throw ExecuteRegisteredProxyOperationException; } return(ExecuteRegisteredProxyOperationRetVal); }
public object ExecuteRegisteredProxyOperation(string assemblyName, string typeName, SPProxyOperationArgs args) { return(SPUtility.ExecuteRegisteredProxyOperation(assemblyName, typeName, args)); }